Skip to content

Commit

Permalink
Fixed initial page title not being cached.
Browse files Browse the repository at this point in the history
  • Loading branch information
funmaker committed May 8, 2021
1 parent 5ae8536 commit 5586015
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/hooks/usePageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export function usePageDataInit(initialData: any): ContextType<typeof PageDataCo
const titleCache = useRef<Record<string, string>>({});

useEffect(() => {
titleCache.current[history.location.pathname] = document.title;

return history.listen(location => {
if(fetchEmitter.current?.key && fetchEmitter.current.key !== location.key) {
fetchEmitter.current?.cancel("Route Change");
Expand Down

0 comments on commit 5586015

Please sign in to comment.