From 748e9b68f3849e62fb6e9be68b8b4affc5a1190d Mon Sep 17 00:00:00 2001 From: Oleh-Kril Date: Fri, 23 Feb 2024 23:27:44 +0200 Subject: [PATCH] reset loader context on streetcode page unmount --- src/app/stores/streetcode-page-loader-store.ts | 4 ++++ src/features/StreetcodePage/Streetcode.component.tsx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/app/stores/streetcode-page-loader-store.ts b/src/app/stores/streetcode-page-loader-store.ts index fbf39ce75..c46299e79 100644 --- a/src/app/stores/streetcode-page-loader-store.ts +++ b/src/app/stores/streetcode-page-loader-store.ts @@ -13,6 +13,10 @@ export default class StreetcodePageLoaderStore { this.loadedBlocks += 1; } + public resetLoadedBlocks() { + this.loadedBlocks = 0; + } + get isPageLoaded():boolean { return this.loadedBlocks >= this.allBlocks; } diff --git a/src/features/StreetcodePage/Streetcode.component.tsx b/src/features/StreetcodePage/Streetcode.component.tsx index 9b72010f9..ec867adbc 100644 --- a/src/features/StreetcodePage/Streetcode.component.tsx +++ b/src/features/StreetcodePage/Streetcode.component.tsx @@ -96,6 +96,8 @@ const StreetcodeContent = () => { toStreetcodeRedirectClickEvent(streetcodeUrl.current, fromPage); clearWindowHistoryState(); } + + return () => pageLoadercontext.resetLoadedBlocks(); }, []); return (