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: forceAlign should not use outdated onAlign callback #86

Merged
merged 2 commits into from
Nov 5, 2020

Conversation

opatut
Copy link
Contributor

@opatut opatut commented Oct 20, 2020

Fixes #85 -- I believe.

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #86 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #86   +/-   ##
=======================================
  Coverage   96.89%   96.89%           
=======================================
  Files           3        3           
  Lines         129      129           
  Branches       31       31           
=======================================
  Hits          125      125           
  Misses          4        4           
Impacted Files Coverage Δ
src/Align.tsx 98.68% <100.00%> (ø)

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 93641c5...b3f5d78. Read the comment docs.

@yoyo837 yoyo837 requested a review from zombieJ October 26, 2020 07:47
@zombieJ
Copy link
Member

zombieJ commented Oct 26, 2020

Test case. Pls?

@opatut
Copy link
Contributor Author

opatut commented Oct 26, 2020

Test case. Pls?

Hi @zombieJ, thanks for reacting to this.

Sadly, the bug ant-design/ant-design#27018 which caused me to trace the problem down into this component is really hard to reproduce, I assume a race condition that only triggers in complex applications due to the browser's timing behaviour (requestAnimationFrame) changing. I do not know how to provide a test case in this standalone environment here, or I would have done it.

@zombieJ
Copy link
Member

zombieJ commented Oct 30, 2020

jest can hack timer, and you can inject raf to replace with setTimeout instead : )

@opatut
Copy link
Contributor Author

opatut commented Nov 2, 2020

It looks like I was able to build a test case. I think raf is not the issue, since that was actually only relevant in producing the race condition through rc-trigger -- I built a test case just with the existing hacked timers. I made sure to comment what is causing the issue for me and why I'm testing it in the test case itself.

Note that this is changing behaviour, and it could be argued that the behaviour from before my changes was the correct one. I think however it is faulty, because it is caused by an internal setTimeout that is mostly invisible to the user. I think the new behaviour is more in line with what I would expect as a user, and it fixes the problem that occurs in ant-design (linked above).

@ghost
Copy link

ghost commented Nov 4, 2020

@zombieJ The antd issue referenced by opatut above was closed by bot, please take a look at that one as several developers have encountered that, and it was hard to reproduce.

@zombieJ zombieJ merged commit 5623813 into react-component:master Nov 5, 2020
@zombieJ
Copy link
Member

zombieJ commented Nov 5, 2020

+ rc-align@4.0.9

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.

forceAlign uses outdated onAlign callback
2 participants