diff --git a/src/components/events.tsx b/src/components/events.tsx new file mode 100644 index 0000000..cbc93fb --- /dev/null +++ b/src/components/events.tsx @@ -0,0 +1,21 @@ +import { onMount } from 'solid-js'; + +const ReloadOnBack = () => { + const handlePageShow = (event: Event) => { + const pageshowEvent = event as PageTransitionEvent; + if (pageshowEvent.persisted) { + window.location.reload(); + } + }; + + onMount(() => { + window.addEventListener('pageshow', handlePageShow); + return () => { + window.removeEventListener('pageshow', handlePageShow); + }; + }); + + return null; +}; + +export default ReloadOnBack; \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index ddc0c79..6ec1f29 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,7 +2,13 @@ import { render } from 'solid-js/web' import App from './App' +import ReloadOnBack from './components/events' const root = document.getElementById('root') -render(() => , root!) +render(() => ( + <> + + + +), root!)