-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: enable allow clear options for single select dropdown #39213
fix: enable allow clear options for single select dropdown #39213
Conversation
WalkthroughThis pull request introduces a new test suite in the DropDownControl component to verify single select functionality. The tests now cover scenarios with a single value, including the ability to clear the selection. Additionally, the component’s logic for displaying the clear option has been updated to allow clearing when the component is explicitly set to allow it through a new property ( Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Runner
participant D as DropDownControl
participant S as Store/State
T->>D: Render dropdown in single select mode (isAllowClear enabled)
D->>S: Load initial single select values
T->>D: Simulate click on Clear button
D->>D: Evaluate condition (isMultiSelect || isAllowClear) && !isEmpty(selectedValue)
D-->>T: Clear selection confirmed
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
app/client/src/components/formControls/DropDownControl.test.tsx (2)
224-296
: Consider adding more test cases for comprehensive coverage.The test suite verifies the clear functionality but would benefit from additional test cases:
- Initial value rendering
- Selecting a new value
- Clear button disabled state when no value is selected
249-263
: Add negative test case for isAllowClear.Add a test case where
isAllowClear
is set to false to verify that the clear button is not rendered.app/client/src/components/formControls/DropDownControl.tsx (1)
370-370
: Add JSDoc documentation for isAllowClear prop.Add documentation to explain the purpose and behavior of this prop.
+ /** Whether to show clear button for single select dropdown */ isAllowClear?: boolean;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/client/src/components/formControls/DropDownControl.test.tsx
(1 hunks)app/client/src/components/formControls/DropDownControl.tsx
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-build / client-build
🔇 Additional comments (1)
app/client/src/components/formControls/DropDownControl.tsx (1)
307-309
: LGTM! Clean implementation of the clear functionality.The condition
(props.isMultiSelect || props.isAllowClear) && !isEmpty(selectedValue)
correctly handles both multi-select and single-select cases.
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13285363243. |
Deploy-Preview-URL: https://ce-39213.dp.appsmith.com |
Description
This PR enables allow clear option for single select dropdowns in the UQI.
Fixes #39087
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.Datasource"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13284739979
Commit: 36b6c94
Cypress dashboard.
Tags:
@tag.Datasource
Spec:
Wed, 12 Feb 2025 12:41:11 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit