-
Notifications
You must be signed in to change notification settings - Fork 338
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
Mitigate warnings when using QRCodeSVG
in server components
#352
Conversation
QRCodeSVG
to be used in a server componentQRCodeSVG
in React server components
@@ -66,5 +66,6 @@ | |||
"ts-jest": "^29.1.0", | |||
"tsup": "^8.0.2", | |||
"typescript": "^5.0.4" | |||
} | |||
}, | |||
"packageManager": "yarn@1.22.22" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side change: this helps Node’s corepack use the right version of yarn. Otherwise, yarn install
may pick v4 and mess up the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done independently but that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree that this change is unrelated, so should have been in another PR. It was one of those borderline sidecar changes that could be tolerable, so I thought I'd sneak it in 😅
QRCodeSVG
in React server componentsQRCodeSVG
in server components
@@ -66,5 +66,6 @@ | |||
"ts-jest": "^29.1.0", | |||
"tsup": "^8.0.2", | |||
"typescript": "^5.0.4" | |||
} | |||
}, | |||
"packageManager": "yarn@1.22.22" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done independently but that's ok.
Thanks for finding the minimal change to get this working! I'll definitely get this into 4.0 (soon - might wait for React 19 just to update peerdeps confidently). TBD if I backport into a v3.y.z release. It should be safe like you said, just not sure I care enough to get this an other technically safe things into another v3. |
Waiting for v4 / React v19 makes sense – the warning is not critical. You probably know this already, but they are delaying 19.0.0 because of one issue with Suspense (tweet | details). Not sure what the new ETA is because of that. If you want to cut v4 beta / rc, happy to give it a spin and share feedback. A backport would be great too, but it’s up to your desire and availability. |
Closes #347
Before this PR, react hooks were imported as named ESM exports. This could generate bundler warnings in frameworks like Next.js:
This PR replaces named imports with properties of the
default
import. This provides a sufficient workaround for now.Going forward, we will need to split the library into separate files so that
QRCodeSVG
could be imported on its own. This will be needed when default react export is removed for tree-shaking. As of React v16...v19, both of these imports are equivalent:(see v18 typings & v19 typings from DefinitelyTyped/DefinitelyTyped#69022)
Some extra context:
I guess it’s a patch change: v3.1.0 → v3.1.1.