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: Slider Tooltip not follow handler #20699

Merged
merged 2 commits into from
Jan 6, 2020
Merged

fix: Slider Tooltip not follow handler #20699

merged 2 commits into from
Jan 6, 2020

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Jan 6, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

fix #20677

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Slider's Tooltip not follow handle.
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@netlify
Copy link

netlify bot commented Jan 6, 2020

Deploy preview for ant-design ready!

Built with commit cf782da

https://deploy-preview-20699--ant-design.netlify.com

components/slider/index.tsx Outdated Show resolved Hide resolved
components/slider/index.tsx Outdated Show resolved Hide resolved
@afc163
Copy link
Member

afc163 commented Jan 6, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 6, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cf782da:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented Jan 6, 2020

Codecov Report

Merging #20699 into master will decrease coverage by 0.06%.
The diff coverage is 76.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20699      +/-   ##
==========================================
- Coverage   97.54%   97.47%   -0.07%     
==========================================
  Files         295      296       +1     
  Lines        6842     6863      +21     
  Branches     1900     1902       +2     
==========================================
+ Hits         6674     6690      +16     
- Misses        168      173       +5
Impacted Files Coverage Δ
components/slider/index.tsx 90% <ø> (ø) ⬆️
components/slider/SliderTooltip.tsx 76.19% <76.19%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6017b3f...cf782da. Read the comment docs.

@shaodahong
Copy link
Member

点一下页面卡死了

@zombieJ
Copy link
Member Author

zombieJ commented Jan 6, 2020

嗯,好像是有 BUG。FC 里看来不能直接依赖 useEffect。

@zombieJ zombieJ changed the title fix: Slider Tooltip not follow handler [WIP] fix: Slider Tooltip not follow handler Jan 6, 2020
@pr-triage pr-triage bot removed the PR: unreviewed label Jan 6, 2020
@zombieJ
Copy link
Member Author

zombieJ commented Jan 6, 2020

找到原因了,新版的 rc-trigger 通过 setState 来控制状态更新,然后内部的 rc-align 每次 force align 都会触发 onAlign 导致上层的 rc-trigger 又重置状态。然后死循环了。

解了我当前好奇为啥 Trigger 和 Align 里各种调用 dom 不用 state 之谜……

我换种方式去解它。

@zombieJ
Copy link
Member Author

zombieJ commented Jan 6, 2020

换了种实现,Tooltip 出现的时候,做重置 align 处理。合完后,我去把 keepAlign 删了。

@zombieJ zombieJ changed the title [WIP] fix: Slider Tooltip not follow handler fix: Slider Tooltip not follow handler Jan 6, 2020
@zombieJ
Copy link
Member Author

zombieJ commented Jan 6, 2020

@shaodahong, 再试试。

@shaodahong
Copy link
Member

rc-slider 也要这么解决?

@zombieJ
Copy link
Member Author

zombieJ commented Jan 6, 2020

rc-slider 不管,用户自己定义自己的 Tooltip 就行了。

@shaodahong
Copy link
Member

好的,那没问题了

@zombieJ zombieJ merged commit c5a40fc into master Jan 6, 2020
@zombieJ zombieJ deleted the fix-slider branch January 6, 2020 12:09
@shaodahong
Copy link
Member

rc-slider 不管,用户自己定义自己的 Tooltip 就行了。

rc-slide demo 估计要更新下

@afc163
Copy link
Member

afc163 commented Jan 7, 2020

我仍然觉得 https://github.com/react-component/slider/pull/615/files#r363582675 这样解决比较彻底。

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] 拖动滑块时 Tooltip 不跟随鼠标
3 participants