Skip to content

[gatsby-plugin-offline][React 18 RC] Hydration error on reload #35193

@mwskwong

Description

@mwskwong

Preliminary Checks

Description

Hydration errors are observed in the PROD build when using React 18 RC and gatsby-plugin-offline.
image

Reproduction Link

https://github.com/mwskwong/react-18-rc-2-repo

Steps to Reproduce

  1. Create a Gatsby project with any template.
  2. Install gatsby-plugin-offline
  3. Upgrade
    1. Gatsby to next
    2. gatsby-plugin-offline to next
    3. React to rc
  4. Build and serve the website.
  5. Open the browser console and load the website once. Note that there will be NO errors at this moment.
  6. Refresh the website once (not force refresh, i.e. F5 instead of Ctrl + F5). And observe the errors in the console.

PROD build of the reproduction: https://react-18-rc-2-repo.pages.dev/

Expected Result

Hydration works correctly with no errors prompted no matter how the webpage is refreshed.

Actual Result

Hydration failed and prompted errors in certain cases.

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Binaries:
    Node: 17.7.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.10.3
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (99.0.1150.46)
  npmPackages:
    gatsby: next => 4.11.0-next.3 
    gatsby-plugin-offline: next => 5.11.0-next.3

Config Flags

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmedIssue with steps to reproduce the bug that’s been verified by at least one reviewer.topic: plugins-PWAIssues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest pluginstype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions