Reloading page when back button is used.
This commit is contained in:
parent
e069fb71b9
commit
95e02d30af
|
@ -13,6 +13,13 @@ async function onRenderClient(pageContext) {
|
|||
const app = createApp(Page, pageProps, pageContext);
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('popstate', () => {
|
||||
// force reload when back button is used
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { onRenderClient };
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import events from './events.js';
|
||||
|
||||
export default function navigate(path, query, options = {}) {
|
||||
const curatedQuery = Object.fromEntries(Object.entries(query || {}).map(([key, value]) => (value === undefined ? null : [key, value])).filter(Boolean));
|
||||
|
||||
|
@ -17,4 +19,6 @@ export default function navigate(path, query, options = {}) {
|
|||
} else {
|
||||
history.pushState({}, '', url); // eslint-disable-line no-restricted-globals
|
||||
}
|
||||
|
||||
events.emit('route', url);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue