Skip to content

Conversation

@krishnprakash
Copy link
Owner

Description

Documentation

Tests

Related Issues

@netlify
Copy link

netlify bot commented May 24, 2025

👷 Deploy request for phileco pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit aea34d8

@krishnprakash krishnprakash enabled auto-merge May 28, 2025 11:41
auto-merge was automatically disabled June 6, 2025 14:18

Head branch was pushed to by a user without write access

gatsbybot and others added 2 commits June 16, 2025 14:04
* fix: ensure rendering engine has vendored libvips

* chore: bump caniuse

* test: visit and intercept direct html routes and avoid hitting redirects which mess up html header assertions
@krishnprakash krishnprakash enabled auto-merge June 22, 2025 17:33
auto-merge was automatically disabled June 23, 2025 18:49

Head branch was pushed to by a user without write access

johnmurphy01 and others added 2 commits June 25, 2025 14:44
docs: improve intro text in README – first contribution by Soundharyaa Shri

Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com>
@krishnprakash krishnprakash enabled auto-merge July 10, 2025 00:34
auto-merge was automatically disabled August 5, 2025 11:56

Head branch was pushed to by a user without write access

pieh and others added 12 commits August 5, 2025 14:46
…pes/* deps, handle change in tmp package (#39343)

* fix: use forked devcert to avoid pulling transitive deps from its @types/* deps

* chore: remove cpy from structured-logging test

* chore: remove del-cli from cli test

* chore: use gatsbyjs fork and not private one

* chore: use @expo/devcert as it is being maintained

* fix: create .cache directory before trying to create temp file in it
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
chore: streamline circleci dependencies

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
* fix: correct renovate paths for deprecated packages

* chore: update lockfile

* chore: remove leftover dead Gatsby Cloud code

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
* chore: simplify Renovate setup

* chore: add back postUpdateOptions, disable automerge

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
fix(deps): upgrade socket.io, socket.io-client
* chore: remove AskGatsbyJS Twitter link

* Apply suggestion from @serhalp

* chore: remove more outdated social refs
* test(gatsby-cli): tolerate varying stack traces

* test: import mocked module the same way it's used

This mismatch stopped working after node 18.

* test: use more specific snapshot for res headers

Some of the connection header defaults depend on the node.js major version

wip this is a fix for the headers one

* test: skip unstable GC tests on node 20+

* test: adjust assertion to work on node 22 locally

See inline comment

* test: fix sharp build error in lmdb-regeneration fixture

The `lmdb-regeneration` integration test fixture had an `.npmrc` file forcing all packages to be
built from source, which caused sharp to fail compilation in Node 20+ CircleCI images (Ubuntu Noble)
due to... who knows what, honestly.

Since this fixture specifically needs lmdb built from source but not sharp (it's testing something
specific to this), this replaces the global `.npmrc` `build-from-source` flag with a targeted
`postinstall` script that only rebuilds lmdb from source, allowing sharp to use prebuilt binaries.

This resolves the "cannot find -l:libvips-cpp.so.42" linker errors that were blocking integration
tests on Node 20+ while preserving the fixture's intended lmdb compilation testing.

AFAICT this was... basically the only solution. Whew

* fix(gatsby): bump `webpack-virtual-modules`

to get this bug fix: sysgears/webpack-virtual-modules#172

causing this, unclear when:
```
TypeError: Cannot read properties of null (reading 'fileWatchers')
```

* ci: test against Node 18, 20, 22

- run unit tests against all three
- run integration tests against earliest and latest
- make sure to separate npm cache by node version

* ci: test against node 22.13 to avoid bug for now
 - babel-plugin-remove-graphql-queries@5.16.0-next.0
 - babel-preset-gatsby-package@3.16.0-next.0
 - babel-preset-gatsby@3.16.0-next.0
 - create-gatsby@3.16.0-next.0
 - gatsby-adapter-netlify@1.4.0-next.0
 - gatsby-cli@5.16.0-next.0
 - gatsby-codemods@4.16.0-next.0
 - gatsby-core-utils@4.16.0-next.0
 - gatsby-cypress@3.16.0-next.0
 - gatsby-design-tokens@5.16.0-next.0
 - gatsby-dev-cli@5.16.0-next.0
 - gatsby-graphiql-explorer@3.16.0-next.0
 - gatsby-legacy-polyfills@3.16.0-next.0
 - gatsby-link@5.16.0-next.0
 - gatsby-page-utils@3.16.0-next.0
 - gatsby-parcel-config@1.16.0-next.0
 - @gatsbyjs/parcel-namer-relative-to-cwd@2.16.0-next.0
 - gatsby-plugin-benchmark-reporting@3.16.0-next.0
 - gatsby-plugin-canonical-urls@5.16.0-next.0
 - gatsby-plugin-catch-links@5.16.0-next.0
 - gatsby-plugin-coffeescript@5.16.0-next.0
 - gatsby-plugin-cxs@5.16.0-next.0
 - gatsby-plugin-emotion@8.16.0-next.0
 - gatsby-plugin-facebook-analytics@5.16.0-next.0
 - gatsby-plugin-feed@5.16.0-next.0
 - gatsby-plugin-flow@4.16.0-next.0
 - gatsby-plugin-fullstory@5.16.0-next.0
 - gatsby-plugin-google-analytics@5.16.0-next.0
 - gatsby-plugin-google-gtag@5.16.0-next.0
 - gatsby-plugin-google-tagmanager@5.16.0-next.0
 - gatsby-plugin-image@3.16.0-next.0
 - gatsby-plugin-jss@5.16.0-next.0
 - gatsby-plugin-layout@4.16.0-next.0
 - gatsby-plugin-less@7.16.0-next.0
 - gatsby-plugin-lodash@6.16.0-next.0
 - gatsby-plugin-manifest@5.16.0-next.0
 - gatsby-plugin-mdx@5.16.0-next.0
 - gatsby-plugin-no-sourcemaps@5.16.0-next.0
 - gatsby-plugin-nprogress@5.16.0-next.0
 - gatsby-plugin-offline@6.16.0-next.0
 - gatsby-plugin-page-creator@5.16.0-next.0
 - gatsby-plugin-postcss@6.16.0-next.0
 - gatsby-plugin-preact@7.16.0-next.0
 - gatsby-plugin-preload-fonts@4.16.0-next.0
 - gatsby-plugin-react-css-modules@5.16.0-next.0
 - gatsby-plugin-react-helmet@6.16.0-next.0
 - gatsby-plugin-sass@6.16.0-next.0
 - gatsby-plugin-schema-snapshot@4.16.0-next.0
 - gatsby-plugin-sharp@5.16.0-next.0
 - gatsby-plugin-sitemap@6.16.0-next.0
 - gatsby-plugin-styled-components@6.16.0-next.0
 - gatsby-plugin-styled-jsx@6.16.0-next.0
 - gatsby-plugin-styletron@8.16.0-next.0
 - gatsby-plugin-stylus@5.16.0-next.0
 - gatsby-plugin-subfont@5.16.0-next.0
 - gatsby-plugin-twitter@5.16.0-next.0
 - gatsby-plugin-typescript@5.16.0-next.0
 - gatsby-plugin-typography@5.16.0-next.0
 - gatsby-plugin-utils@4.16.0-next.0
 - gatsby-react-router-scroll@6.16.0-next.0
 - gatsby-remark-autolink-headers@6.16.0-next.0
 - gatsby-remark-code-repls@7.16.0-next.0
 - gatsby-remark-copy-linked-files@6.16.0-next.0
 - gatsby-remark-custom-blocks@5.16.0-next.0
 - gatsby-remark-embed-snippet@8.16.0-next.0
 - gatsby-remark-graphviz@5.16.0-next.0
 - gatsby-remark-images-contentful@6.16.0-next.0
 - gatsby-remark-images@7.16.0-next.0
 - gatsby-remark-katex@7.16.0-next.0
 - gatsby-remark-prismjs@7.16.0-next.0
 - gatsby-remark-responsive-iframe@6.16.0-next.0
 - gatsby-remark-smartypants@6.16.0-next.0
 - gatsby-script@2.16.0-next.0
 - gatsby-sharp@1.16.0-next.0
 - gatsby-source-contentful@8.17.0-next.0
 - gatsby-source-drupal@6.16.0-next.0
 - gatsby-source-faker@5.16.0-next.0
 - gatsby-source-filesystem@5.16.0-next.0
 - gatsby-source-graphql@5.16.0-next.0
 - gatsby-source-hacker-news@5.16.0-next.0
 - gatsby-source-lever@5.16.0-next.0
 - gatsby-source-medium@5.16.0-next.0
 - gatsby-source-mongodb@5.16.0-next.0
 - gatsby-source-npm-package-search@5.16.0-next.0
 - gatsby-source-shopify@10.1.0-next.0
 - gatsby-source-wikipedia@5.16.0-next.0
 - gatsby-source-wordpress@7.17.0-next.0
 - gatsby-transformer-asciidoc@4.16.0-next.0
 - gatsby-transformer-csv@5.16.0-next.0
 - gatsby-transformer-documentationjs@7.16.0-next.0
 - gatsby-transformer-excel@5.16.0-next.0
 - gatsby-transformer-hjson@5.16.0-next.0
 - gatsby-transformer-javascript-frontmatter@5.16.0-next.0
 - gatsby-transformer-json@5.16.0-next.0
 - gatsby-transformer-pdf@4.16.0-next.0
 - gatsby-transformer-react-docgen@8.16.0-next.0
 - gatsby-transformer-remark@6.16.0-next.0
 - gatsby-transformer-screenshot@5.16.0-next.0
 - gatsby-transformer-sharp@5.16.0-next.0
 - gatsby-transformer-sqip@5.16.0-next.0
 - gatsby-transformer-toml@5.16.0-next.0
 - gatsby-transformer-xml@5.16.0-next.0
 - gatsby-transformer-yaml@5.16.0-next.0
 - gatsby-worker@2.16.0-next.0
 - gatsby@5.16.0-next.0
auto-merge was automatically disabled August 27, 2025 12:52

Head branch was pushed to by a user without write access

auto-merge was automatically disabled November 14, 2025 13:21

Head branch was pushed to by a user without write access

serhalp and others added 3 commits November 14, 2025 09:51
* ci: fix e2e debug output setup

See #39373 (comment).

- use correct unscoped paths for both `store_artifacts` and `store_test_results`
- create missing directories to avoid error noise

* ci: remove unused Cypress Cloud setup

It adds unnecessary noise and complexity to our CI config.
This adds support for React 19 to all Gatsby packages, while maintaining support for React 18.

This is not a breaking change. You can safely upgrade to this release while staying on React 18.

All packages' peer dependencies on `react` and `react-dom` have been extended from `^18.0.0` to `^18.0.0 || ^19.0.0`.

All existing **stable** Gatsby functionality is intended to work with React 19.

## Upgrade Guide

> [!NOTE]
> **Community** plugins may not have been updated yet to support React 19, so please check their repository for the current status. All plugins managed by the Gatsby team (in the [gatsbyjs/gatsby](https://github.com/gatsbyjs/gatsby) repository) have been updated.

To upgrade to React 19, first upgrade `gatsby` and all your dependencies that start with `gatsby-` to the latest version. (Check out [this guide](https://www.gatsbyjs.com/docs/reference/release-notes/upgrade-gatsby-and-dependencies/) if you need help with that.)

> [!TIP]
>  If you use npm 7 or higher you’ll want to use the `--legacy-peer-deps` option. For example, if you use `gatsby` and `gatsby-plugin-postcss`:
> 
> ```sh
> npm install --legacy-peer-deps gatsby@latest gatsby-plugin-postcss@latest
> ```

Then, [follow the React 19 upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide). No other changes are required.

Please note:
- Some _new_ React 19 features may not be available yet via Gatsby.
  - Notably, the new [document metadata hoisting feature](https://react.dev/blog/2024/12/05/react-19#support-for-metadata-tags) is disabled in Gatsby, as it conflicts with the existing [Gatsby Head API](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-head/)
- Gatsby [Partial Hydration](https://www.gatsbyjs.com/docs/how-to/performance/partial-hydration), an **experimental** feature for three years now, is known to be **incompatible with React 19** at this time. If you rely on this feature, do not upgrade to React 19.

## New features

Gatsby now supports [React 19's new root error callbacks](https://react.dev/blog/2024/12/05/react-19#error-handling).

Users can export `onCaughtError` and `onUncaughtError` from their `gatsby-browser.js` to handle errors caught by error boundaries and uncaught errors respectively:

```js
// gatsby-browser.js

export const onCaughtError = ({ error, errorInfo }) => {
  // e.g. send to an error tracking service
  myErrorTracker.reportError(error, { extra: errorInfo })
}

export const onUncaughtError = ({ error, errorInfo }) => {
  // e.g. send to an error tracking service
  myErrorTracker.captureException(error, { extra: errorInfo })
}
```

In development, these errors also appear in Gatsby's Fast Refresh error overlay. These callbacks are only invoked in React 19.

## Implementation

This PR configures CI to run the existing `development-runtime` and `production-runtime` e2e test suites against both React 18 and 19.

### fix([gatsby-plugin-image](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image/)): work around a regression in React 19 core

There is an undocumented change in behaviour in React 19: facebook/react#31660. Basically, in previous versions, an unchanged `dangerouslySetInnerHTML.__html` would not result in a re-render, but in React 19 referential equality of the `dangerouslySetInnerHTML` object is used instead.

The `gatsby-plugin-image` implementation fundamentally depends on the previous behaviour, so that our own `innerHTML` updates do not get clobbered by a reset to this `dangerouslySetInnerHTML` placeholer value.

As a workaround, this commit memoizes the object with `useMemo()`.

This is safe for React 18 as well.

### fix: replace usages of `__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED` 😶

There was one use of `React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactDebugCurrentFrame?.getCurrentStack()`. React 19 introduced `React.captureOwnerStack()` which we'll now use instead if available.

### fix: avoid conflicts between Gatsby Head API and new [React 19 document metadata feature](https://react.dev/blog/2024/12/05/react-19#support-for-metadata-tags)

There are two conflicts here:
1. React 19 no longer allows rendering a second `<html>` or `<body>` element anywhere in the tree.
2. React 19 hoists document metadata tags (`<title>`, `<meta>`, etc.) automatically into the `<head>`, with similar semantics as Gatsby's Head API.

These both conflict with Gatsby's Head API implementation, which renders all these elements in a hidden `<div>`, which it later finds to extract, merge, and apply attributes on the actual DOM nodes.

We work around this with two techniques:
  - Tags that ultimately belong in `<head>` are wrapped in an `<svg>` tag 😬, which prevents React 19's new mechanism from hoisting them, letting Gatsby process them as before.
  - We monkey-patch `React.createElement` (when using React 19 only) to intercept `<html>` and `<body>` elements within the Gatsby Head API context, replacing them with `<div data-original-tag="html|body">` stand-ins. This allows Gatsby to extract attributes from these elements without triggering React 19's restrictions.

#### Future work

- Expose less magical `<HtmlAttributes>` and `<BodyAttributes>` components (or some other API) to allow phasing out the nonstandard `<html>`/`<body>` magic?
- Refactor Gatsby Head API implementation to use the native React document metadata functionality when available? or remove this part of the Gatsby Head API entirely in favour of users leveraging React's feature directly
- Remove `<svg>` workaround by augmenting the `React.createElement` monkey-patch to check for `<title>`, `<meta>`, etc.? One workaround is better than two, maybe.

### Experimental Partial Hydration incompatibility with React 19

Gatsby's experimental Partial Hydration feature has been flagged as experimental for about three years and relies on React's experimental `react-server-dom-webpack` package APIs that were substantially overhauled between React 18 and 19 as part of the RSC stabilization effort. Gatsby has been pinned to version `0.0.0-experimental-c8b778b7f-20220825` for years. The feature used experimental RSC APIs that no longer exist or are incompatible with React 19 for various reasons. Porting to React 19's stabilized RSC architecture would require _substantial effort_ and the feature has seen limited adoption. It took massive research and iteration for other frameworks to reach RSC maturity and much of the effort was in underlying bundlers. It's very unlikely Gatsby will tackle this.

The problematic import (`react-server-dom-webpack`) was previously imported statically at the top of the module, causing React 19 projects to encounter import errors even when not using Partial Hydration. In this PR, we simply moved the import to a conditional async import that only loads when Partial Hydration is actually enabled via the (existing) opt-in flag.

This allows the majority of Gatsby projects to safely upgrade to React 19 while allowing projects that have opted in to Partial Hydration to continue using it by remaining on React 18 while still being able to receive Gatsby upgrades.

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
 - babel-plugin-remove-graphql-queries@5.17.0-next.0
 - babel-preset-gatsby-package@3.17.0-next.0
 - babel-preset-gatsby@3.17.0-next.0
 - create-gatsby@3.17.0-next.0
 - gatsby-adapter-netlify@1.5.0-next.0
 - gatsby-cli@5.17.0-next.0
 - gatsby-codemods@4.17.0-next.0
 - gatsby-core-utils@4.17.0-next.0
 - gatsby-cypress@3.17.0-next.0
 - gatsby-design-tokens@5.17.0-next.0
 - gatsby-dev-cli@5.17.0-next.0
 - gatsby-graphiql-explorer@3.17.0-next.0
 - gatsby-legacy-polyfills@3.17.0-next.0
 - gatsby-link@5.17.0-next.0
 - gatsby-page-utils@3.17.0-next.0
 - gatsby-parcel-config@1.17.0-next.0
 - @gatsbyjs/parcel-namer-relative-to-cwd@2.17.0-next.0
 - gatsby-plugin-benchmark-reporting@3.17.0-next.0
 - gatsby-plugin-canonical-urls@5.17.0-next.0
 - gatsby-plugin-catch-links@5.17.0-next.0
 - gatsby-plugin-coffeescript@5.17.0-next.0
 - gatsby-plugin-cxs@5.17.0-next.0
 - gatsby-plugin-emotion@8.17.0-next.0
 - gatsby-plugin-facebook-analytics@5.17.0-next.0
 - gatsby-plugin-feed@5.17.0-next.0
 - gatsby-plugin-flow@4.17.0-next.0
 - gatsby-plugin-fullstory@5.17.0-next.0
 - gatsby-plugin-google-analytics@5.17.0-next.0
 - gatsby-plugin-google-gtag@5.17.0-next.0
 - gatsby-plugin-google-tagmanager@5.17.0-next.0
 - gatsby-plugin-image@3.17.0-next.0
 - gatsby-plugin-jss@5.17.0-next.0
 - gatsby-plugin-layout@4.17.0-next.0
 - gatsby-plugin-less@7.17.0-next.0
 - gatsby-plugin-lodash@6.17.0-next.0
 - gatsby-plugin-manifest@5.17.0-next.0
 - gatsby-plugin-mdx@5.17.0-next.0
 - gatsby-plugin-no-sourcemaps@5.17.0-next.0
 - gatsby-plugin-nprogress@5.17.0-next.0
 - gatsby-plugin-offline@6.17.0-next.0
 - gatsby-plugin-page-creator@5.17.0-next.0
 - gatsby-plugin-postcss@6.17.0-next.0
 - gatsby-plugin-preact@7.17.0-next.0
 - gatsby-plugin-preload-fonts@4.17.0-next.0
 - gatsby-plugin-react-css-modules@5.17.0-next.0
 - gatsby-plugin-react-helmet@6.17.0-next.0
 - gatsby-plugin-sass@6.17.0-next.0
 - gatsby-plugin-schema-snapshot@4.17.0-next.0
 - gatsby-plugin-sharp@5.17.0-next.0
 - gatsby-plugin-sitemap@6.17.0-next.0
 - gatsby-plugin-styled-components@6.17.0-next.0
 - gatsby-plugin-styled-jsx@6.17.0-next.0
 - gatsby-plugin-styletron@8.17.0-next.0
 - gatsby-plugin-stylus@5.17.0-next.0
 - gatsby-plugin-subfont@5.17.0-next.0
 - gatsby-plugin-twitter@5.17.0-next.0
 - gatsby-plugin-typescript@5.17.0-next.0
 - gatsby-plugin-typography@5.17.0-next.0
 - gatsby-plugin-utils@4.17.0-next.0
 - gatsby-react-router-scroll@6.17.0-next.0
 - gatsby-remark-autolink-headers@6.17.0-next.0
 - gatsby-remark-code-repls@7.17.0-next.0
 - gatsby-remark-copy-linked-files@6.17.0-next.0
 - gatsby-remark-custom-blocks@5.17.0-next.0
 - gatsby-remark-embed-snippet@8.17.0-next.0
 - gatsby-remark-graphviz@5.17.0-next.0
 - gatsby-remark-images-contentful@6.17.0-next.0
 - gatsby-remark-images@7.17.0-next.0
 - gatsby-remark-katex@7.17.0-next.0
 - gatsby-remark-prismjs@7.17.0-next.0
 - gatsby-remark-responsive-iframe@6.17.0-next.0
 - gatsby-remark-smartypants@6.17.0-next.0
 - gatsby-script@2.17.0-next.0
 - gatsby-sharp@1.17.0-next.0
 - gatsby-source-contentful@8.18.0-next.0
 - gatsby-source-drupal@6.17.0-next.0
 - gatsby-source-faker@5.17.0-next.0
 - gatsby-source-filesystem@5.17.0-next.0
 - gatsby-source-graphql@5.17.0-next.0
 - gatsby-source-hacker-news@5.17.0-next.0
 - gatsby-source-lever@5.17.0-next.0
 - gatsby-source-medium@5.17.0-next.0
 - gatsby-source-mongodb@5.17.0-next.0
 - gatsby-source-npm-package-search@5.17.0-next.0
 - gatsby-source-shopify@10.2.0-next.0
 - gatsby-source-wikipedia@5.17.0-next.0
 - gatsby-source-wordpress@7.18.0-next.0
 - gatsby-transformer-asciidoc@4.17.0-next.0
 - gatsby-transformer-csv@5.17.0-next.0
 - gatsby-transformer-documentationjs@7.17.0-next.0
 - gatsby-transformer-excel@5.17.0-next.0
 - gatsby-transformer-hjson@5.17.0-next.0
 - gatsby-transformer-javascript-frontmatter@5.17.0-next.0
 - gatsby-transformer-json@5.17.0-next.0
 - gatsby-transformer-pdf@4.17.0-next.0
 - gatsby-transformer-react-docgen@8.17.0-next.0
 - gatsby-transformer-remark@6.17.0-next.0
 - gatsby-transformer-screenshot@5.17.0-next.0
 - gatsby-transformer-sharp@5.17.0-next.0
 - gatsby-transformer-sqip@5.17.0-next.0
 - gatsby-transformer-toml@5.17.0-next.0
 - gatsby-transformer-xml@5.17.0-next.0
 - gatsby-transformer-yaml@5.17.0-next.0
 - gatsby-worker@2.17.0-next.0
 - gatsby@5.17.0-next.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants