Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix feature detection of React.startTransition #10569

Merged

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Jun 7, 2023

I'm not quite sure why the current feature detection approach wasn't sufficient 😕 . It works fine in vite but apparently has issues in webpack. the react team doesn't do anything funny like this in their useSyncExternalStore shim package and I can't imagine that has issues on webpack and React 17.

Either way, moving to a constant seems to fix the webpack compilation issue.

Closes #10566

@changeset-bot
Copy link

changeset-bot bot commented Jun 7, 2023

🦋 Changeset detected

Latest commit: 6069e2a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +303 to +305
// Webpack + React 17 fails to compile on the usage of `React.startTransition` or
// `React["startTransition"]` even if it's behind a feature detection of
// `"startTransition" in React`. Moving this to a constant avoids the issue :/
Copy link

Choose a reason for hiding this comment

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

I'd assume it's tied to the import * as React from "react" import, the more typical usage is import React from "react".

Any chance of shipping this as is to un-break consumers btw? It's having pretty broad impact

Copy link
Contributor Author

Choose a reason for hiding this comment

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

import React from "react" is deprecated as of React 17

https://twitter.com/dan_abramov/status/1308739731551858689

Copy link

Choose a reason for hiding this comment

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

Good to know! 👍 Either way it's likely the reason why you saw this issue here but not in other places.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

🤖 Hello there,

We just published version 6.12.1-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

🤖 Hello there,

We just published version 6.12.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@sudheerhebbale
Copy link

Tested the application with the fix
Confirmed that the issue is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Compilation of react app fails with error ERROR in ./node_modules/react-router/dist/index.js 840:33-54
4 participants