Skip to content

Migrate codebase to React 18 - #298

Merged
utnapischtim merged 9 commits into
inveniosoftware:masterfrom
oarepo:mirekys/react-18-migration
Nov 9, 2026
Merged

utnapischtim merged 9 commits into
inveniosoftware:masterfrom
oarepo:mirekys/react-18-migration

Conversation

@mirekys

@mirekys mirekys commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

❤️ Thank you for your contribution!

Description

Migrate react-searchkit from React 16 to React 18 following RFC inveniosoftware/rfcs#112.

  • Upgrades peer dependencies
  • Replaces enzyme adapter for React18 suppoort
  • Removes explicit React imports (update-react-imports codemod)
  • Migrates render-only class components to functions (pure-component codemod)
  • Updates demo entry points to createRoot (update-react-imports codemod)
  • Applies formatting for React 18

Prerequisites

To make React 18 linting work, you need to link a local clone of eslint-config-invenio:

gh repo clone inveniosoftware/eslint-config-invenio
gh pr checkout 20
cd eslint-config-invenio
npm link

In this repo:

npm link @inveniosoftware/eslint-config-invenio
  • All demos works as before without changes
  • All tests pass
  • npm audit down to just 2 moderate severity vulnerabilities (due to webpack-dev-server - didn't manage to solve that one)

Requires:

Part of: inveniosoftware/rfcs#112

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

  • I'm aware of the code of conduct.
  • I've created logical separate commits and followed the commit message format.
  • I've added relevant test cases.
  • I've added relevant documentation.
  • I've marked translation strings.
  • I've identified the copyright holder(s) and updated copyright headers for touched files (>15 lines contributions).
  • I've NOT included third-party code (copy/pasted source code or new dependencies).
    • If you have added third-party code (copy/pasted or new dependencies), please reach out to an architect on Discord.

Frontend

  • I've followed the CSS/JS and React guidelines.
  • I've followed the web accessibility guidelines.
  • I've followed the user interface guidelines.

@mirekys
mirekys marked this pull request as draft April 24, 2026 17:39
@mirekys
mirekys marked this pull request as ready for review April 28, 2026 15:48
@mirekys mirekys added this to v15 Apr 28, 2026
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from 9f8bd52 to d55223b Compare April 29, 2026 13:10
@mirekys mirekys changed the title Migrate to React 18 Migrate codebase to React 18 Apr 30, 2026
@mirekys
mirekys marked this pull request as draft April 30, 2026 16:29
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from d55223b to 9d43498 Compare May 5, 2026 09:57
@mirekys mirekys moved this to 🏗 In progress in v15 May 5, 2026
@mirekys mirekys self-assigned this May 5, 2026
@mirekys
mirekys marked this pull request as ready for review May 5, 2026 10:23
@mirekys mirekys mentioned this pull request May 6, 2026
7 of 10 tasks
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from ed3fcdb to 58f618e Compare May 6, 2026 08:33

@OliverGeneser OliverGeneser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread package.json
Comment on lines +113 to +128
"overrides": {
"react-scripts": {
"svgo": "^3.3.2",
"resolve-url-loader": "^5.0.0",
"css-minimizer-webpack-plugin": "^8.0.0"
},
"underscore": "^1.13.8",
"@tootallnate/once": "^3.0.1",
"sockjs": "^0.3.24",
"uuid": "^14.0.0",
"serialize-javascript": "^7.0.5",
"workbox-build": "^7.3.0",
"@svgr/webpack": "^6.5.1",
"enzyme": {
"cheerio": "1.0.0-rc.12"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is these overrides needed? Because it's not done in inveniosoftware/react-invenio-forms#334 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are here there purely to address npm audit vulnerability issues. For react-invenio-forms, it reports basically just something about old tinymce (which i'm tackling with a separate PR)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed from tinymce to hugerte in the python modules

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't think that pywebpack takes overrides into account, so we are using the updated libraries here when using npm, but not when integrating this module in InvenioRDM.

@ntarocco ntarocco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have added a small comment.

Comment thread package.json Resolved

@OliverGeneser OliverGeneser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to add presets: [['react-app', { runtime: 'automatic' }]], to rollup.config.js

@fenekku fenekku moved this from 🏗 In progress to Discarded from this version ➡ in v15 Jul 30, 2026
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch 2 times, most recently from a11d740 to d356610 Compare November 6, 2026 10:57
* Upgrades react and react-dom from ^16.13.0 to ^18.3.0
* Upgrades eslint-config-invenio to ^2.1.0
* Replaces enzyme-adapter-react-16 with
  @cfaester/enzyme-adapter-react-18 ^0.8.0
* Requires Node version >=22.0.0
* Applies update-react-imports codemod
* Applies pure-component codemod
* Migrates ReactDOM.render to createRoot API
* Removes unused devDependencies
  (cheerio, coveralls, expect)
* Not used or needed with Node 22+ & React v18
* Fixes npm audit warnings
@utnapischtim

Copy link
Copy Markdown

@mirekys you can remove v22 from the test matrix.

* Replaces enzyme adapter for React 18 compatibility
* Replaces eslint rules to apply React 18 rules
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from d6a1560 to d465db6 Compare November 6, 2026 13:00
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch 3 times, most recently from c536f05 to 01b58f8 Compare November 9, 2026 10:28
@mirekys

mirekys commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

I think ready for review & release now, tested locally against inveniordm -c master

@Samk13 Samk13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One minor issue noted inline. Thanks for this!

OliverGeneser and others added 2 commits November 9, 2026 12:38
* Adds prop-types as a peer dependency (imported by components,
  but never declared, so pnpm did not install it)
* Mirrors the npm "overrides" for enzyme's cheerio in
  pnpm-workspace.yaml, as pnpm ignores package.json "overrides"
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from 01b58f8 to 848c211 Compare November 9, 2026 11:39
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from 848c211 to 7657e8e Compare November 9, 2026 15:18
 * Replaces Docusaurus v1 in docs/website with v3
 * Preserves existing docs/ source files
 * Fixes MDX v3 escaping issue in range_facet.md
@mirekys
mirekys force-pushed the mirekys/react-18-migration branch from 7657e8e to 3e70553 Compare November 9, 2026 15:58
@utnapischtim
utnapischtim merged commit e8c9f4e into inveniosoftware:master Nov 9, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Discarded from this version ➡ to To release 🤖 in v15 Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To release 🤖

Development

Successfully merging this pull request may close these issues.

6 participants