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

ensure onBeforeChange is called when clicking the rail #822

Merged
merged 3 commits into from Apr 12, 2022

Conversation

dasl-
Copy link
Contributor

@dasl- dasl- commented Mar 21, 2022

In version 10.0.0-alpha.5, when you click the rail, the following events are fired: onChange, onAfterChange. This PR ensures that onBeforeChange will be fired as well.

Background: there has historically been some bugginess around which events are fired when clicking on the rail. In version 8.6.1, we correctly fired all three: onBeforeChange, onChange, onAfterChange.

In version 9.7.5, we fired too many events when clicking on the rail: onBeforeChange, onChange, onBeforeChange, onAfterChange.

See this issue for more people that have been affected by these event firing inconsistencies: #492

@vercel
Copy link

vercel bot commented Mar 21, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/slider/5jZT5v67WDJQ9GRXeqAr2HHLDCiW
✅ Preview: https://slider-git-fork-dasl-click-rail-react-component.vercel.app

@dasl-
Copy link
Contributor Author

dasl- commented Apr 11, 2022

Hi there @MadCcc @zombieJ , any chance you could take a look at this bug fix PR? I see you all have been active lately. Thank you!

@afc163
Copy link
Member

afc163 commented Apr 11, 2022

Test case is needed

@@ -489,13 +489,23 @@ describe('Slider', () => {

describe('click slider to change value', () => {
it('ltr', () => {
const onBeforeChange = jest.fn();
Copy link
Member

Choose a reason for hiding this comment

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

Could you help create a new test case instead of modify current one?

@afc163
Copy link
Member

afc163 commented Apr 12, 2022

CI broken

@codecov
Copy link

codecov bot commented Apr 12, 2022

Codecov Report

Merging #822 (74224ee) into master (46936f0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #822   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          13       13           
  Lines         532      533    +1     
  Branches      135      135           
=======================================
+ Hits          531      532    +1     
  Misses          1        1           
Impacted Files Coverage Δ
src/Slider.tsx 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@afc163 afc163 merged commit 0c209f0 into react-component:master Apr 12, 2022
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.

None yet

3 participants