-
Notifications
You must be signed in to change notification settings - Fork 36
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
Warning: A history supports only one prompt at a time (ie, using multiple <NavigationPrompt /> is a bad idea?) #42
Comments
Thanks, @rsmylskibc ! Would you please make a pull request for this change? |
Fix #42: moved unblock assign to CDM
@ZacharyRSmith I have the latest 1.8.4 version and I still have the "Warning: A history supports only one prompt at a time" error message... P.S. both components are present in the DOM (I have two tabs and toggle between them on state change) |
@Ameer157 thanks for bringing this to my attention, would you please PR a fix, or at least provide a reproducible example? Or @kuhelbeher, could you look more into this? Thanks! |
Thanks for the attention @ZacharyRSmith 🥇 The bug can be reproduced by having two instances of I hope I was clear enough |
Yes, you are clear, thanks. Just as an FYI: I don't have the time to debug this. Hopefully someone else will be able to look into this! |
No worries, thanks anyways! |
I had a different case - two components with @Ameer157, maybe you can place |
Thanks for the tip @kuhelbeher - this is a perfect walk-around 👍 |
Works for me too! Thanks! |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If you are using
NavigationPrompt
inside multiple components that can be rendered inside a parent component,Warning: A history supports only one prompt at a time
is thrown if you change from rendering one component that usesNavigationPrompt
to another component usingNavigationPrompt
.If the current behavior is a bug, please provide the steps to reproduce.
Create two components that include
NavigationPrompt
as a child.Create a component that will render the first component by default, then conditionally render the second component instead on a state change.
What is the expected behavior?
NavigationPrompt should appropriately bind to
history.block
utilizing lifecycle methods, not binding before it needs to.With doing some of my own debugging, if
history.block
is not set tostate.unblock
during the constructor, but incomponentDidMount
this collision does not occur.The text was updated successfully, but these errors were encountered: