Skip to content

Commit

Permalink
Force reload the page after SW update
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Jan 26, 2025
1 parent 0e086ac commit 9f5ca03
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/client/components/PWAPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ export default memo(function PWAPrompt() {
type="button"
className="btn btn-sm btn-primary"
onClick={async () => {
window.history.pushState(
null,
'',
`${window.location.origin}${window.location.pathname}?d=${await Compressor.compress(
Serializer.stringifyPuzzle({ ...metadata, grid, solution })
)}`
);
const newLocation = `${window.location.origin}${window.location.pathname}?d=${await Compressor.compress(
Serializer.stringifyPuzzle({ ...metadata, grid, solution })
)}`;
window.history.pushState(null, '', newLocation);
await updateServiceWorker(true);
window.location.replace(newLocation);
}}
>
Reload
Expand Down

0 comments on commit 9f5ca03

Please sign in to comment.