I have an Aurelia application where the user can select the company they\'re currently \"working on\". Every page in the app is dependent on the currently selected company,
Here is a simple solution to refresh the page:
in aurelia-history-browser.js, added a check in updateHash()
and if the new _href is equal to the old then reload the page from the cache (not the server).
Then, to refresh the page you just need to use the existing options:
router.navigateToRoute('watch', {}, { replace: true, trigger: true });
The updated code is copied below:
function updateHash(location, fragment, replace) {
if (replace) {
var _href = location.href.replace(/(javascript:|#).*$/, '') + '#' + fragment;
if (_href == location.href)
location.reload(false);
else
location.replace(_href);
} else {
location.hash = '#' + fragment;
}
}