-
Notifications
You must be signed in to change notification settings - Fork 7
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
React strict mode bug #382
Comments
@catamphetamine is there a reason you haven't PR'd your hooks fix to this repo? |
@rosskevin I guess the reason is that I completely rewrote the component and that would be not a small PR as a result. More like complete file replacement rather than a small diff of it. So PR or not PR, it would be easier to just copy-and-paste the file by replacing the old one in this library. PRs are mostly for smaller diffs. |
Perhaps you misunderstand. PRs are for improvements. This is an improvement and I for one would like to use it. I do not want to copy/paste improvements of code from the ecosystem into my source tree, I want to share the burden of maintenance/improvements with the rest of the world via the original repos/dependencies. I looked where you put the code and it seems like you are trying to copy/paste all kinds of dependencies into your repo but not give back to the sources. I don't think you are heading down a path that is sustainable. |
Nah, I don't.
Yes.
And you can do so by copy-pasting the file to your project.
Your choice. I'll pass.
I wonder how making the source codes publicly available on the Internet leads to "not give back to the sources".
So fixing issues of an open-source repo and then showing the fix to the maintainers is somehow non-sustainable to a casual passer on the Internet. Ok. |
@rosskevin I dunno if GitHub still notifies a user when someone from the blacklist messages them. In any case, I've blocked you due to the apparent non-constructive/aggressive behavior in your comments. |
A
scroll-behavior
instance is created in theconstructor()
of the<ScrollManager/>
component.According to React strict mode docs, that's an anti-pattern that results in incorrect operation.
componentDidMount()
is called withthis
beingB
componentWillUnmount()
is called withthis
beingB
componentDidMount()
is called withthis
beingB
Because of that, clean-up of Component instance A is not run and a scroll event listener with stale
props
(initial location) responds to scroll events forever.A fix would be creating a
scroll-behavior
instance incomponentDidMount()
.I also rewrote
<ScrollManager/>
in React hooks in case you're interested:https://github.com/catamphetamine/react-pages/blob/master/lib/router/client/found-scroll/ScrollManager.js
(it also contains the fix for the issue)
(I don't guarantee the correctness of the rewrite though)
The text was updated successfully, but these errors were encountered: