fix(router): store root/default page instruction correctly #1869
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.
Pull Request
π Description
When a user used the browser's "back" button, the root ("/") default page was not correctly reloaded.
π« Issues
Resolves #1812.
π©βπ» Reviewer Notes
In the current code (without this PR), all routing instructions are always prepended with
-
(updateNavigation
).The issue is due to a simple fact:
(empty) equals
-
+-
. And-
(minus) is used to clear the current path/page. Thus, when we navigate to/
, then to another page, the root page is lost and replaced by-
.My current fix simply checks whether the instruction is empty, and if so, it prevent the clear instruction to be added.
π Test Plan
β Next Steps