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

fix: onAfterChange should not trigger when click on track #952

Merged
merged 4 commits into from Nov 30, 2023

Conversation

MadCcc
Copy link
Member

@MadCcc MadCcc commented Nov 29, 2023

Copy link

vercel bot commented Nov 29, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
slider ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 30, 2023 3:34am

@@ -329,7 +329,6 @@ const Slider = React.forwardRef((props: SliderProps, ref: React.Ref<SliderRef>)

onBeforeChange?.(getTriggerValue(cloneNextValues));
triggerChange(cloneNextValues);
onAfterChange?.(getTriggerValue(cloneNextValues));
Copy link
Member

Choose a reason for hiding this comment

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

为啥 onBeforeChange 可以有, onAfterChange不能?

Copy link
Member Author

@MadCcc MadCcc Nov 30, 2023

Choose a reason for hiding this comment

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

onAfterChange 必须对应到 mouseup 事件上,现在允许拖拽之后 change 并不代表一定会触发 afterChange

onChangeComplete?.();
break;
}
}

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (90% of all statements in
the enclosing function
have an explicit semicolon).
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fa77b3e) 99.81% compared to head (331d28f) 99.82%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #952   +/-   ##
=======================================
  Coverage   99.81%   99.82%           
=======================================
  Files          13       13           
  Lines         551      561   +10     
  Branches      151      160    +9     
=======================================
+ Hits          550      560   +10     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MadCcc MadCcc merged commit 99316a2 into master Nov 30, 2023
11 checks passed
@MadCcc MadCcc deleted the fix/after-change branch November 30, 2023 03:35
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.

Slider onAfterChange 事件会在 onmousedown 阶段触发
2 participants