Skip to content

chore: update react and related dependencies to latest versions#7929

Open
TusharThakur04 wants to merge 9 commits intowebpack:mainfrom
TusharThakur04:chore/update-react-version
Open

chore: update react and related dependencies to latest versions#7929
TusharThakur04 wants to merge 9 commits intowebpack:mainfrom
TusharThakur04:chore/update-react-version

Conversation

@TusharThakur04
Copy link
Contributor

Closes: #7920
Replaces: #7925

Summary
This PR :

  • updates React and related dependencies to their latest versions.
  • removes react-visibility-sensor as it relied on findDOMNode, which was removed in React 19, and replaces it with a ref-based implementation using IntersectionObserver — a native browser API that is more performant and future-proof.
  • replaces the react-router-dom/server import with react-router, since React Router v7 moved SSR utilities like StaticRouter out of react-router-dom and into the core react-router package. react-router is also added as an explicit dependency.
  • adds Web Streams API globals (TextEncoder, TextDecoder, TransformStream) to the SSG webpack config, as React Router v7's streaming SSR now depends on these browser-native APIs that weren't required by the previous stack.
  • guards against undefined helmet context and assets.css during SSR, accounting for subtle behavioral changes in renderToString under React 19.

What kind of change does this PR introduce?
chore

Did you add tests for your changes?
no

Does this PR introduce a breaking change?
no

If relevant, what needs to be documented once your changes are merged or what have you already documented?

Use of AI
i have used sonet 4.6 for conversing and generating refactor code.
i have tested the generated code by myself locally and its working fine.

@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Mar 7, 2026 1:27am

Request Review

src/server.jsx Outdated

const { helmet } = helmetContext;

console.log("helmetContext:", JSON.stringify(helmetContext));
Copy link
Member

Choose a reason for hiding this comment

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

Remove this

src/server.jsx Outdated

console.log("helmetContext:", JSON.stringify(helmetContext));

const htmlAttrs = helmet?.htmlAttributes?.toString() ?? "";
Copy link
Member

Choose a reason for hiding this comment

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

it is ai generated code, helmet is always define

"import/extensions": "off",
"import/default": "off",
"unicorn/prefer-top-level-await": "off",
"react/no-deprecated": "off",
Copy link
Member

@alexander-akait alexander-akait Mar 6, 2026

Choose a reason for hiding this comment

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

No no, you need to fix it, I clear say no deprecations, remove it and fix problems

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is because of
Screenshot from 2026-03-06 23-38-22

should i change the documentation?

@alexander-akait
Copy link
Member

Also it doesn't work, go to http://webpack-js-org-git-fork-tusharthakur04-chore-upda-860284-openjs.vercel.app/ and open dev tools

vendor.84e8b55b5cc3f91e.js:2 Uncaught Error: Minified React error #418; visit https://react.dev/errors/418?args[]=HTML&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at ma (vendor.84e8b55b5cc3f91e.js:2:493987)
    at is (vendor.84e8b55b5cc3f91e.js:2:543335)
    at cc (vendor.84e8b55b5cc3f91e.js:2:581270)
    at sc (vendor.84e8b55b5cc3f91e.js:2:581198)
    at oc (vendor.84e8b55b5cc3f91e.js:2:581040)
    at Ql (vendor.84e8b55b5cc3f91e.js:2:576466)
    at Lc (vendor.84e8b55b5cc3f91e.js:2:592301)
    at MessagePort.x (vendor.84e8b55b5cc3f91e.js:2:662140)
ma @ vendor.84e8b55b5cc3f91e.js:2
is @ vendor.84e8b55b5cc3f91e.js:2
cc @ vendor.84e8b55b5cc3f91e.js:2
sc @ vendor.84e8b55b5cc3f91e.js:2
oc @ vendor.84e8b55b5cc3f91e.js:2
Ql @ vendor.84e8b55b5cc3f91e.js:2
Lc @ vendor.84e8b55b5cc3f91e.js:2
x @ vendor.84e8b55b5cc3f91e.js:2

@alexander-akait
Copy link
Member

alexander-akait commented Mar 6, 2026

Anyway looks like site works and the right direction, let's resolve problems above

@TusharThakur04
Copy link
Contributor Author

build is totally fine, test failing

@alexander-akait
Copy link
Member

alexander-akait commented Mar 6, 2026

@TusharThakur04 build is not fine, go to site and open dev tools, I provided the error above

@TusharThakur04
Copy link
Contributor Author

TusharThakur04 commented Mar 6, 2026

@alexander-akait manual helmet context extraction is no longer needed in react-19

+ import App from './App';
+ ReactDOM.render(<App />, document.getElementById('root'));
+ const root = createRoot(document.getElementById('root'));
+ root.render(<App />);
Copy link
Member

Choose a reason for hiding this comment

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

Why it was changed here? Please use different branches (PRs) for different tasks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Got it, looks fine for me

@alexander-akait
Copy link
Member

Still on site:

vendor.84e8b55b5cc3f91e.js:2 Uncaught Error: Minified React error #418; visit https://react.dev/errors/418?args[]=HTML&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at ma (vendor.84e8b55b5cc3f91e.js:2:493987)
    at is (vendor.84e8b55b5cc3f91e.js:2:543335)
    at cc (vendor.84e8b55b5cc3f91e.js:2:581270)
    at sc (vendor.84e8b55b5cc3f91e.js:2:581198)
    at oc (vendor.84e8b55b5cc3f91e.js:2:581040)
    at Ql (vendor.84e8b55b5cc3f91e.js:2:576466)
    at Lc (vendor.84e8b55b5cc3f91e.js:2:592301)
    at MessagePort.x (vendor.84e8b55b5cc3f91e.js:2:662140)

for debug reasons you can disable minimization and look at the message, fix it and then return minimization

@TusharThakur04
Copy link
Contributor Author

@alexander-akait cypress tests are working fine locally but failing in ci

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.

update react to the latest version

2 participants