Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow reset optional items #4759

Merged
merged 4 commits into from
Jan 19, 2025
Merged

fix: Allow reset optional items #4759

merged 4 commits into from
Jan 19, 2025

Conversation

istarkov
Copy link
Member

@istarkov istarkov commented Jan 19, 2025

Description

Allow resetting optional items in the following cases:

  1. The item has a value and undefined defaultValue
  2. The item has a value, defaultValue is not undefined and is not equal to value
  • - Fix placeholder is not shown

Todo Next PR

Remove empty prop check

// Boolean check is not a mistake; it excludes empty values.

Switch on undefined.

Steps for reproduction

Case 1.

  • - HeadSlot/HeadLink

Select value, reset value

image

Case 2.

  • - Youtube Component
    Unselect
image

Reset to default.

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 0000)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env file

@istarkov istarkov requested a review from TrySound January 19, 2025 06:05
@istarkov istarkov marked this pull request as ready for review January 19, 2025 06:05
@istarkov istarkov requested a review from kof January 19, 2025 06:18
Copy link
Member

@kof kof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@istarkov istarkov merged commit 7f114f4 into main Jan 19, 2025
17 checks passed
@istarkov istarkov deleted the allow-reset branch January 19, 2025 09:42
istarkov added a commit that referenced this pull request Jan 20, 2025
## Description

This #4759 allows to not filter out empty props

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants