From: Dessalines Date: Fri, 16 Jul 2021 13:05:28 +0000 (-0400) Subject: Don't restore scroll position on page refresh. Fixes #186 X-Git-Url: http://these/git/%7Bpost_view.post.url%7D?a=commitdiff_plain;h=35f1b18e67a85c4e847c8a676eeab889e9a1a1d7;p=lemmy-ui.git Don't restore scroll position on page refresh. Fixes #186 --- diff --git a/src/shared/services/WebSocketService.ts b/src/shared/services/WebSocketService.ts index 1bf12fd..4c91d40 100644 --- a/src/shared/services/WebSocketService.ts +++ b/src/shared/services/WebSocketService.ts @@ -43,8 +43,11 @@ export class WebSocketService { }).pipe(share()); if (isBrowser()) { - window.onbeforeunload = () => { + window.onunload = () => { this.ws.close(); + + // Clears out scroll positions. + sessionStorage.clear(); }; } }