-
-
Notifications
You must be signed in to change notification settings - Fork 324
fix: value is not work when set to null #913
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough本次修改调整了 Changes
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
src/PickerInput/hooks/useRangeValue.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
CodeRabbit Configuration File (
|
* fix: value is not work when set to null * fix: innerValue only judge null (cherry picked from commit 6bc9cb4) # Conflicts: # src/PickerInput/hooks/useRangeValue.ts
* fix: value is not work when set to null * fix: innerValue only judge null (cherry picked from commit 6bc9cb4) # Conflicts: # src/PickerInput/hooks/useRangeValue.ts Co-authored-by: Electrolux <59329360+electroluxcode@users.noreply.github.com>
ref #912 (comment) |
The root cause is that the useMergedState hook in the rc-utils library does not handle the case where value is null correctly.
It considers null as hasValue, which leads to incorrect state management.
Half a year ago, we encountered the issue where defaultValue did not work when value was null, and we patched it specifically for defaultValue.
However, recently we discovered that when value is null, the UI also becomes completely non-functional, which is confusing.
If rc-util cannot be updated for some reason, then we will have to handle the update and compatibility at the application level. After all, it is very abnormal that passing null to value does not work, while passing undefined works as expected.
The solution is to replace null with undefined when the value is empty, as useMergedState can handle undefined properly.
fix: #912
refer: react-component/util#578
Summary by CodeRabbit
null
值处理为undefined
,提高了整体的可靠性。