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

wrapPageElement and wrapRootElement Remount Layout Component on Page Navigation after redeploying to production Environment on Chrome After Upgrading to Gatsby 4.25.9 or 5.13.7 #39131

Open
2 tasks done
pengyiwang opened this issue Oct 7, 2024 · 1 comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@pengyiwang
Copy link

pengyiwang commented Oct 7, 2024

Preliminary Checks

Description

Thank you for taking the time to look into this issue. I recently upgraded my Gatsby project from version ^2.32.0 to 4.25.9 or 5.13.7, and encountered an issue that only occurs in the production environment on Chrome.

Summary:

Issue Description: After redeploying to the production environment, the layout component used in wrapPageElement or wrapRootElement remounts on page navigation when using navigate or Link.

Conditions:

The issue only occurs on Chrome.

The issue disappears if I disable the browser cache in Chrome DevTools.

The issue disappears if I change cache setting to no-store on Firebase hosting

The issue only appears after redeploying to production. It does not occur when the app is opened for the first time or when using an incognito window.

No issue was observed in version ^2.32.0, but it started appearing after upgrading to 4.25.9 or 5.13.7.

The issue does not occur on Safari and Firefox.

Previous Attempts: I've attempted to use wrapRootElement and changed navigate to Link, as recommended in issue #16489, but the issue persists.

Reproduction Link

Unfortunately, I cannot provide a reproduction link as the issue only occurs after redeploying to production.

Steps to Reproduce

截屏2024-10-07 22 30 49
截屏2024-10-07 22 31 36

First Screenshot: Shows the network tab in Chrome, highlighting the repeated request of app-xxx.js when cache is enabled.

Second Screenshot: Shows the same page when cache is disabled — the repeated request does not occur.

Expected Result

The layout component should not remount when navigating to a new page after redeploying the app to production.

Actual Result

The layout component remounts when navigating to a new page after redeploying the app to production, only on Chrome.

Environment

Gatsby Version: 4.25.9

Hosting: Firebase Hosting

OS and Browser: macOS (Chrome only)

Caching: Disabling cache in Chrome removes the issue.

Config Flags

flags: process.env.NODE_ENV === 'development' ? {
    FAST_DEV: true,
  } : {},
@pengyiwang pengyiwang added the type: bug An issue or pull request relating to a bug in Gatsby label Oct 7, 2024
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 7, 2024
@pengyiwang
Copy link
Author

I confirmed it, the issue also happens on version 5.13.7, and it only happens on Chrome, but not on Safari and Firefox, tested on several Mac

@pengyiwang pengyiwang changed the title wrapPageElement and wrapRootElement Remount Layout Component on Page Navigation after redeploying to production Environment on Chrome After Upgrading to Gatsby 4.25.9 wrapPageElement and wrapRootElement Remount Layout Component on Page Navigation after redeploying to production Environment on Chrome After Upgrading to Gatsby 4.25.9 or 5.13.7 Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants
@pengyiwang and others