feat: add optional navigateHistory prop to RouterView #453
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've got a current issue in relation to the RouterView component and its automatic handling of backtracking through app history.
In our app, we have a navigation bar that sits at the top level alongside the RouterView component. In our nav we've got multiple routes that we move between, and we want to be able to refocus the nav by pressing
backfrom any of those routes.The issue is that when using
this.parent.$focus(e)we want to call thebackhandler in our app, but instead it is getting stuck at the RouterView, at which point it automatically navigates to the last page in history.As a potential fix for this, we could have an optional prop for the RouterView component
navigateHistorythat when set to false disables the automatic backtracking, and instead passes any back press up to the app, so that it can be handled without triggering automatic navigation.Example of how to use:
<RouterView navigateHistory="false" />