]> Untitled Git - lemmy-ui.git/commitdiff
Don't restore scroll position on page refresh. Fixes #186
authorDessalines <tyhou13@gmx.com>
Fri, 16 Jul 2021 13:05:28 +0000 (09:05 -0400)
committerDessalines <tyhou13@gmx.com>
Fri, 16 Jul 2021 13:05:28 +0000 (09:05 -0400)
src/shared/services/WebSocketService.ts

index 1bf12fd5c619040249d97b829dc49e5be8d45476..4c91d405006071dc75d0b4617611f9e788f21854 100644 (file)
@@ -43,8 +43,11 @@ export class WebSocketService {
     }).pipe(share());
 
     if (isBrowser()) {
-      window.onbeforeunload = () => {
+      window.onunload = () => {
         this.ws.close();
+
+        // Clears out scroll positions.
+        sessionStorage.clear();
       };
     }
   }