Skip to content

Comments

client: Reload entries by clicking on active menu item#1300

Merged
jtojnar merged 6 commits intomasterfrom
force-reload
Jan 5, 2022
Merged

client: Reload entries by clicking on active menu item#1300
jtojnar merged 6 commits intomasterfrom
force-reload

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Jan 5, 2022

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

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
It would clear the changes, potentially leading to data loss.

One can still reset the changes by cancelling the editing and clicking edit again.
when they have a route associated.
@jtojnar jtojnar merged commit 54f1530 into master Jan 5, 2022
@jtojnar jtojnar deleted the force-reload branch January 5, 2022 17:49
@jtojnar jtojnar added this to the 2.19 milestone Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clicking active filter/tag/source should reload it

1 participant