Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dev-ssr): don't dispatch CREATE_SERVER_VISITED_PAGE if component is already tracked #28725

Merged
merged 1 commit into from
Dec 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/gatsby/src/redux/actions/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,12 @@ actions.removePageData = (id: PageDataRemove) => {
* @param {string} $0.id the chunkName for the page component.
*/
actions.createServerVisitedPage = (chunkName: string) => {
if (store.getState().visitedPages.get(`server`)?.has(chunkName)) {
// we already have given chunk tracked, let's not emit `CREATE_SERVER_VISITED_PAGE`
// action to not cause any additional work
return []
}

return {
type: `CREATE_SERVER_VISITED_PAGE`,
payload: { componentChunkName: chunkName },
Expand Down