-
Notifications
You must be signed in to change notification settings - Fork 75
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: Text resource unsetting issues #14568
Conversation
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
frontend/libs/studio-components/src/components/StudioTextResourcePicker/StudioTextResourcePicker.test.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-storybook". (The package "eslint-plugin-storybook" was not found when loaded as a Node module from the directory "/frontend/libs/studio-components".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-storybook" was referenced from the config file in "frontend/libs/studio-components/.eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. 📝 WalkthroughWalkthroughThis pull request updates the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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 (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14568 +/- ##
==========================================
- Coverage 95.73% 95.73% -0.01%
==========================================
Files 1906 1906
Lines 24844 24843 -1
Branches 2848 2848
==========================================
- Hits 23785 23784 -1
Misses 799 799
Partials 260 260 ☔ View full report in Codecov by Sentry. |
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.
One nitpick comment added 😄
.../studio-components/src/components/StudioTextResourcePicker/StudioTextResourcePicker.test.tsx
Outdated
Show resolved
Hide resolved
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.
Nice workaround. Tested in Storybook - I think it works great now.
Description
As discovered during manual testing, the text resource selector sometimes changes the value in its text field unexpectedly while the user is writing:
https://github.com/user-attachments/assets/ea0a526b-5b67-41c5-be8c-c821cc3aae14
The reason for this is that when the user changes the value so that it becomes invalid,
onValueChange
is called with an empty array, which in turn triggers a rerender with the option representing an unset value as selected.Fixing this using the API from The Design System doesn't seem to be possible without complex workarounds. The
Combobox
component undertakes some unpredictable behaviour, and the fact that it's asynchronous adds to the complexity. It is also deprecated in The Design System, so it will probably not be improved. When we have upgraded The Design System and itsSuggestion
component is out of the experimental phase, we should updateTextResourcePicker
to use that component. Meanwhile, I have chosen to solve the current issue by removing the label of the unset option. I have placed it in the description instead, so that it is still visible.Here is a demo:
https://github.com/user-attachments/assets/5dc64021-88c0-4186-9c06-502293b67124
Related Issue(s)
Verification
Summary by CodeRabbit
Bug Fixes
Tests