-
Notifications
You must be signed in to change notification settings - Fork 6
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(slider): Prevent onChange/onChangeAfter called on mount #253
Merged
imprashast
merged 5 commits into
warp-ds:next
from
vsandvold:prevent-onchange-called-on-mount
Jul 3, 2024
Merged
fix(slider): Prevent onChange/onChangeAfter called on mount #253
imprashast
merged 5 commits into
warp-ds:next
from
vsandvold:prevent-onchange-called-on-mount
Jul 3, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR replaces and closes #251 |
vsandvold
commented
Jul 2, 2024
// It could be caused by limitations in the testing library | ||
// as mentioned in the docs: | ||
// https://testing-library.com/docs/guide-events#interactions-vs-events | ||
expect(onChange).toHaveBeenCalledTimes(0); |
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.
Manual testing with storybook shows clearly that the onChange callback is called on every update to the slider value, both from clicking and dragging the slider.
imprashast
approved these changes
Jul 2, 2024
felicia-haggqvist
approved these changes
Jul 2, 2024
github-actions bot
pushed a commit
that referenced
this pull request
Jul 3, 2024
# [1.6.0-next.6](v1.6.0-next.5...v1.6.0-next.6) (2024-07-03) ### Bug Fixes * **slider:** Prevent onChange/onChangeAfter called on mount ([#253](#253)) ([84ddd64](84ddd64))
github-actions bot
pushed a commit
that referenced
this pull request
Jul 3, 2024
# [1.6.0](v1.5.0...v1.6.0) (2024-07-03) ### Bug Fixes * add default targetEl for callout ([#248](#248)) ([e297880](e297880)) * bump core to fix slider ([#250](#250)) ([5192147](5192147)) * **slider:** Prevent onChange/onChangeAfter called on mount ([#253](#253)) ([84ddd64](84ddd64)) ### Features * add warp ds eslint config ([#238](#238)) ([d83f799](d83f799)) * slider onChangeAfter prop ([#247](#247)) ([fa1af5c](fa1af5c)) * **toggle:** add ReactNode type to toggle labels ([#244](#244)) ([abeff99](abeff99))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds guards to the onChange/onChangeAfter useEffect hooks, making sure the callbacks are invoked only when the slider value changes.