Skip to content

Commit

Permalink
Merge pull request #1161 from ita-social-projects/fix/streetcode-page…
Browse files Browse the repository at this point in the history
…-loading

reset loader context on streetcode page unmount
  • Loading branch information
Oleh-Kril authored Feb 23, 2024
2 parents a7c5fb1 + 748e9b6 commit f44f269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/stores/streetcode-page-loader-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default class StreetcodePageLoaderStore {
this.loadedBlocks += 1;
}

public resetLoadedBlocks() {
this.loadedBlocks = 0;
}

get isPageLoaded():boolean {
return this.loadedBlocks >= this.allBlocks;
}
Expand Down
2 changes: 2 additions & 0 deletions src/features/StreetcodePage/Streetcode.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ const StreetcodeContent = () => {
toStreetcodeRedirectClickEvent(streetcodeUrl.current, fromPage);
clearWindowHistoryState();
}

return () => pageLoadercontext.resetLoadedBlocks();
}, []);

return (
Expand Down

0 comments on commit f44f269

Please sign in to comment.