-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-router v4 #209
Comments
I think i know what it could be. There is indeed a setState in Transtion and if the component unmounts it can theoretically fire and cause a warning. Thankfully it's rather harmless, but i'll put some safeguards up. |
Hope it's okay to piggyback on this issue to ask a related question - The demos linked by @kbysiec above are relying on absolute positioning. If we relatively position the Route rendered components, they animate simultaneously and the entering component appears below the leaving component while doing so - and then moves up into its proper position only after the leaving animation is completed. (Here's a forked codepen with position set as relative: https://codesandbox.io/s/n7lv2l27l0 ) Any thoughts on how one could chain the transitions, or set the leaving transition as |
transitions are always stacks, the exit-out transition can be relative, which is useful for lists, but for anything that replaces content you probably want it to be absolute, so that it overlays the previous content. If you could set the exit transition immediate it would simply disappear without trace. Real chaining would need some more thought put into it, perhaps in v6. You could write it into the umbrella issue that's currently open. |
Thanks for that, I will add my voice to the roadmap discussion. Meanwhile, I tried to replace the Transition with a Spring in some of the routes in the sandbox I linked before: https://codesandbox.io/s/n7lv2l27l0 so that I could continue working with a relatively positioned component (y'know, for science). As you can see if you scroll down to the HSL component (line 60), I have used a I believe So - could I suggest a reset/rerun property that either reruns the animation on every render or takes a boolean as value? Something like Let me know what you think or if there's an existing workaround I'm missing. |
Are you on the latest react-spring? i recently fixed a bug that had something to do with reset. It did cause the endless loop under some conditions, but shouldn't any longer - and if it still does, i'd love to see the sandbox for it. |
Aha, that did it. Props to you! ;) |
@kbysiec i've set up protections against async setstate now. |
Hi! First of all I would like to thank you for your time and effort for community and such an amazing lib!
I was looking for solution allowing to have transition of react-router-dom route changes and found #2 related to react-router v4.
Trying to recreate it using the newest version of react-spring I noticed the following in the console:
Warning: Cannot update during an existing state transition (such as within render or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to componentWillMount.
https://codesandbox.io/s/x2j968z0vw
I started further investigation and noticed:
Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
- https://codesandbox.io/s/0m1x0m4klwCould you be so kind and have a look?
Thanks
The text was updated successfully, but these errors were encountered: