Skip to content

feat: support React 18 and 19 - #8093

Open
martinjagodic wants to merge 6 commits into
mainfrom
feat/react-18-19-support
Open

martinjagodic wants to merge 6 commits into
mainfrom
feat/react-18-19-support

Conversation

@martinjagodic

@martinjagodic martinjagodic commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Decap now officially supports both React 18 and React 19. Published packages accept either as a peer, decap-cms-core stops installing its own React, and CI runs the unit tests and the build against React 18 as well. The workspace itself still installs, builds and tests on React 19, and the decap-cms script-tag bundle still ships React 19.

Peer range

Every published package that declared a react/react-dom peer now declares ^18.0.0 || ^19.0.0.

The range lives in a named pnpm catalog, catalogs.peer in pnpm-workspace.yaml, and the manifests reference it as catalog:peer:

  • One place to change the supported range. decap-cms-backend-forgejo and decap-cms-widget-richtext had already drifted to literal ^19.1.0 peers, which is what writing the range into 37 manifests by hand leads to.
  • The default catalog keeps pinning react/react-dom ^19.1.0, so the workspace's own install stays on React 19. The peers pnpm auto-installs for workspace packages resolve to the same 19.2.0 (one React copy in the lockfile).
  • pnpm pack/pnpm publish resolve named catalogs the same as the default one. Checked by packing decap-cms-core, decap-cms-widget-richtext and decap-cms: the tarball manifests contain "react": "^18.0.0 || ^19.0.0" and no catalog:/workspace: strings. pnpm run test:package-integrity passes, and so does scripts/smoke-install-packed.mjs (npm and pnpm).

Dependency fix

decap-cms-core listed react and react-dom in dependencies as well as peerDependencies, which can install a second React next to the host app's ("Invalid hook call"). They are peers only now.

The only other published package with React in dependencies was the decap-cms bundle. It bundles React 19 for the script-tag install, so it only needs React to build, and React is now a devDependency there (the bundle still contains React 19.2.0). This was required, not tidying: with react@^19.1.0 as a runtime dependency next to the new ^18 || ^19 peers, npm i decap-cms failed with ERESOLVE (react-redux 7 peers on React ≤ 18, and npm now had an 18 it could pick), and scripts/smoke-install-packed.mjs, which installs decap-cms and decap-cms-app together, looped in npm's resolver until killed.

One npm behaviour change to know about: npm i decap-cms-app without naming React now auto-installs React 18.3.1, because several third-party peers (table below) allow 18 but not 19. npm i decap-cms-app react react-dom, which is what the README says, still gets React 19, and pinning react@18 gets 18; both install cleanly with a single React copy.

react-is is also gone from core. Its only use was isElement() in the preview pane, and react-is 16 does not recognise React 19 elements (new $$typeof symbol), so a preview template registered as an element was handed to createElement() and failed on React 19 today. React's own isValidElement works on both.

React 18 test results

Run in a throwaway worktree with react/react-dom overridden to 18.3.1 (single copy in the lockfile):

  • Build: failed at first in decap-cms-widget-markdown and decap-cms-widget-richtext with Can't resolve 'react-dom/server'. The webpack alias added in perf: drop duplicate and unused code from the decap-cms bundle #8032 hardcoded React 19's file name for the legacy server renderer; React 18 names it .production.min.js. Fixed in scripts/webpack.js by looking for either name. After that the whole build passes and the decap-cms bundle contains React 18.3.1.
  • Unit tests: 4 suites failed, all test-only artefacts of how React 18 and 19 serialize props on the specs' mock custom elements (className becomes a classname attribute, booleans become "true"/"false" strings), plus one exact console.error count that React 18 doubles because it still checks propTypes itself. The collapsed assertions in ListControl.spec.js passed on React 18 regardless of the value, so they now read the attribute through a helper that understands both. With that, the only remaining differences are 31 snapshots, which the React 18 CI job rewrites instead of comparing. Everything else passes (2304 tests).
  • Demo app (test backend, headless Chrome), production and development builds: login, collection list, entry editor, typing in a string field and in the richtext/markdown editors with the preview updating, the kitchen-sink entry (48 fields incl. map, relation, select, list), adding a list item, picking a relation, required-field validation toasts, saving an entry, the media library and the workflow page all work. No page errors specific to React 18.
  • React 18 warnings (development only): React 18.3's "Support for defaultProps will be removed from function components" deprecation for the inline SVG icons (babel-plugin-inline-react-svg), I18n (react-polyglot) and ReactMarkdown, and the duplicated propTypes warnings in components that call PropTypes.checkPropTypes manually for React 19. Both are harmless.
  • React 19-only APIs: none. No use(), useActionState, useOptimistic, useFormStatus, context-as-provider, ref cleanup functions, or function components taking ref as a plain prop (the one ref-forwarding wrapper uses forwardRef). Rendering uses createRoot from react-dom/client, which React 18 has.

Third-party runtime dependencies with a React peer

Direct runtime dependencies of published packages, with the installed version's declared peer range:

Package Used by react peer Excludes
react-redux 7.2.9 core ^16.8.3 || ^17 || ^18 19
@reduxjs/toolkit 1.9.7 core ^16.9.0 || ^17.0.0 || ^18 (optional) 19
react-scroll-sync 0.11.3 core 16.x || 17.x || 18.x (also react-dom) 19
react-waypoint 10.3.0 core ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 19
react-split-pane 0.1.92 core ^16.0.0-0 (also react-dom) 18 and 19
react-aria-menubutton 7.0.3 ui-default ^16.3.0 || ^17.0.0 18 and 19
react-codemirror2 7.3.0 widget-code >=15.5 <=17.x 18 and 19
react-toastify 10.0.6 core >=18 none
react-modal 3.16.3 core ... || ^18 || ^19 none
react-select 5.10.2 widget-code, -relation, -select ... || ^18.0.0 || ^19.0.0 none
react-textarea-autosize 8.5.9 widget-text ... || ^18.0.0 || ^19.0.0 none
react-window 1.8.11 core, widget-relation ... || ^18.0.0 || ^19.0.0 none
react-virtualized-auto-sizer 1.0.26 core ... || ^18.0.0 || ^19.0.0 none
react-dnd 14.0.5 core >= 16.14 none
react-frame-component 5.2.7 core >= 16.3 none
react-router-dom / react-router 5.3.4 core >=15 none
react-markdown 6.0.3 core >=16 none
react-polyglot 0.7.2 core >=16.8.0 none
react-topbar-progress-indicator 4.1.1 core >=16.8.0 none
react-transition-group 4.4.5 ui-default, widget-code >=16.6.0 none
react-color 2.19.3 widget-colorstring * none
@emotion/react 11.14.0, @emotion/styled 11.14.1 many >=16.8.0 none
@dnd-kit/* widget-file, -list, -relation >=16.8.0 none
slate-react 0.117.4 widget-markdown >=18.2.0 none
platejs / @platejs/* 53 widget-richtext >=18.0.0 none

None of the ones that exclude 19 is new: they are the existing peer mismatches smoke-install-packed.mjs already allows (KNOWN_NPM_LS_INVALID). React 18 makes nothing worse, and three of them (react-split-pane, react-aria-menubutton, react-codemirror2) already exclude 18 too but work on it, as the demo smoke test shows. No majors were upgraded here; react-redux 8+/9, a newer react-scroll-sync and replacements for the unmaintained react-split-pane, react-aria-menubutton and react-codemirror2 are follow-ups.

CI

New build-unit-react-18 job in .github/workflows/nodejs.yml, next to build-unit (ubuntu, Node 24, no e2e):

  1. Adds react: ^18.3.1 and react-dom: ^18.3.1 to overrides in pnpm-workspace.yaml. An override, not a catalog change: the peers pnpm auto-installs for workspace packages stay locked to 19 otherwise, since 19 already satisfies ^18.0.0 || ^19.0.0.
  2. pnpm install --no-frozen-lockfile, then fails if any React 19 is left in the lockfile.
  3. pnpm run test:unit --updateSnapshot (snapshots are compared in the React 19 job) and pnpm run build.

Lint and type-check stay on React 19 only, since the types are @types/react 19. The job is not a required check until it is added to branch protection.

Docs

packages/decap-cms-app/README.md now says React 18 and React 19 are both supported. That is the only doc on main that mentions a React version. #8092 (not merged) says "React 19" in three places that should become "React 18 or 19" once both are in: AGENTS.md (decap-cms-app "with React 19 as a peer dependency"), context7.json ("decap-cms-app needs React 19 from npm."), and packages/decap-cms-app/README.md ("Install it with React 19:"). "React 19 has no UMD builds" stays true. The two PRs merge cleanly in either order.

Release impact

lerna will bump these 38 packages (their package.json changed, and package.json is not in ignoreChanges): decap-cms, decap-cms-app, decap-cms-core, decap-cms-default-exports, decap-cms-editor-component-image, decap-cms-lib-turbo, decap-cms-media-library-s3, decap-cms-ui-auth, decap-cms-ui-default, every decap-cms-backend-* (aws-cognito-github-proxy, azure, bitbucket, forgejo, git-gateway, gitea, github, gitlab, proxy, test, turbo-github, turbo-gitlab) and every decap-cms-widget-* (boolean, code, colorstring, datetime, file, image, list, map, markdown, number, object, relation, richtext, select, string, text, uuid). The feat: commit makes the 37 peer-range packages minor bumps; decap-cms gets a patch from its fix: commit (and would be bumped as their dependent anyway). scripts/webpack.js and the workflow are outside packages/ and bump nothing.

Test plan

  • pnpm run lint-quiet, pnpm run type-check, pnpm run test:unit on React 19
  • pnpm run test:package-integrity; packed manifests contain the literal peer range
  • node scripts/smoke-install-packed.mjs (npm, yarn 4, yarn 1, pnpm)
  • npm i of the packed tarballs: decap-cms alone, decap-cms-app alone, and with explicit react@^19 / react@^18
  • React 18: unit tests, full build, demo app smoke test (production and development builds)
  • CI: build-unit-react-18 green (unit tests 32s, build 4.5 min)

decap-cms-core listed react and react-dom in dependencies as well as
peerDependencies. A package manager can then install a second copy of
React next to the host app's, which breaks hooks ("Invalid hook call")
and context. React is now a peer only, as it is everywhere else.

react-is goes too. Its only use was isElement() in the preview pane,
and react-is 16 does not recognise React 19 elements (they use a new
$$typeof symbol), so a preview template registered as an element was
passed to createElement() and failed. React's own isValidElement works
on every React version.
Published packages now declare react and react-dom peers as
`^18.0.0 || ^19.0.0`. The range lives in a named pnpm catalog,
`catalogs.peer`, and every package references it as `catalog:peer`,
so there is one place to change it and pnpm pack/publish writes the
literal range into the published manifest. The default catalog keeps
pinning React 19, which the workspace installs, builds and tests
against.

decap-cms-backend-forgejo and decap-cms-widget-richtext had literal
`^19.1.0` peers instead of the catalog; they use `catalog:peer` too.

The decap-cms bundle keeps react and react-dom (19) as dependencies:
it bundles them for the script-tag install.
The webpack alias that points react-dom/server at the legacy browser
renderer hardcoded React 19's file name. React 18 names the production
build `react-dom-server-legacy.browser.production.min.js`, so building
against React 18 failed in the markdown and richtext widgets with
"Can't resolve 'react-dom/server'". Look for either name, and fall
back to no alias if neither exists.
The ListControl mocks are custom elements. React 19 renders a `true`
prop on one as an empty attribute and leaves `false` out, while React
18 writes both as strings, so `toHaveAttribute('collapsed')` passed on
React 18 whatever the value. Read the attribute through a helper that
understands both.

Editor checks its propTypes itself because React 19 stopped doing so.
React 18 still does, so the warning the spec expects is logged twice
there; assert on the message instead of an exact call count.
Add a build-unit-react-18 job next to build-unit. It overrides react
and react-dom to ^18.3.1 in pnpm-workspace.yaml, installs without the
frozen lockfile, checks that no React 19 is left, and runs the unit
tests and the build. An override is needed rather than a catalog
change: the peers pnpm auto-installs for workspace packages stay
locked to 19, which already satisfies `^18.0.0 || ^19.0.0`.

Snapshots are rewritten instead of compared in this job, since they
record React 19's serialization of the tests' mock custom elements.
Lint, type-check and e2e stay on React 19 only.
decap-cms bundles React into dist/decap-cms.js, so it only needs react
and react-dom to build. As runtime dependencies they pinned ^19.1.0
next to decap-cms-app's new `^18.0.0 || ^19.0.0` peer, and npm could
no longer resolve the tree: `npm i decap-cms` failed with ERESOLVE
(react-redux 7 peers on React <= 18 and npm now had an 18 to choose),
and installing decap-cms together with decap-cms-app, as
scripts/smoke-install-packed.mjs does, looped in the resolver.

As devDependencies they still build the bundle, which still contains
React 19, and npm resolves the peers on its own.
@martinjagodic
martinjagodic requested a review from a team as a code owner November 19, 2026 14:13
@netlify

netlify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for decap-cms ready!

Name Link
🔨 Latest commit ee06b56
🔍 Latest deploy log https://app.netlify.com/projects/decap-cms/deploys/6aff041d9eadfbaaab07e4cd
😎 Deploy Preview https://deploy-preview-8093--decap-cms.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature code contributing to the implementation of a feature and/or user facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant