client: Reload entries by clicking on active menu item #1300
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.
This is quite hacky – router does not re-render the route when clicking on an already active link because its data is based on the document.location. To bypass this, we need to pass an extra value in the location’s state object that will let us know we should reload. And for similar reasons, it cannot just be a boolean (or we would have to clear the state each time to be able to tell when the value changes again) so we are back at increasing counters.
Unfortunately, that is not end of it since any navigation would clear the state, triggering another reload so we also need to use another counter that only increases when the counter in location state increases.
Fixes: #1287