Skip to content

Commit 76a3b57

Browse files
authored
chore(dev-ssr): don't dispatch CREATE_SERVER_VISITED_PAGE if component is already tracked (#28725)
1 parent 3727947 commit 76a3b57

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/gatsby/src/redux/actions/public.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,12 @@ actions.removePageData = (id: PageDataRemove) => {
13981398
* @param {string} $0.id the chunkName for the page component.
13991399
*/
14001400
actions.createServerVisitedPage = (chunkName: string) => {
1401+
if (store.getState().visitedPages.get(`server`)?.has(chunkName)) {
1402+
// we already have given chunk tracked, let's not emit `CREATE_SERVER_VISITED_PAGE`
1403+
// action to not cause any additional work
1404+
return []
1405+
}
1406+
14011407
return {
14021408
type: `CREATE_SERVER_VISITED_PAGE`,
14031409
payload: { componentChunkName: chunkName },

0 commit comments

Comments
 (0)