-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
feat(jsx/dom): improve compatibility with React - The 2024 May Update #2756
Conversation
…tiple times for the same element
@usualoma Thanks! I'll check it later. |
Hi @usualoma ! I've tried your project, but "Toast 2" and "Tooltip" are not working. Could you check them? I also tried using The Toast and Tooltip in shading/ui with this PR in my project, but it does not work well, though my setup may be wrong. |
@yusukebe Thank you! Hmmm, I wonder why. CleanShot.2024-05-24.at.08.17.47.mp4I started over from
If you were using |
Wow, it works after I've done this instruction! Thanks! |
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.
LGTM!
Added hook
useInsertionEffect
useInsertionEffect
is implemented.https://ja.react.dev/reference/react/useInsertionEffect
Fixed Features
createPortal
When
createPortal
was called repeatedly in the same context, the DOM was not updated correctly.fixed in 8974135.
Update when
key
attribute is not specifiedAdjusted the rules for finding old elements when the key attribute is not specified so that the behavior is more like React. efb876e
Attribute name for SVGElement
SVGElement has a variety of attribute names, some are camel cases, some are kebab cases. So far, we have not converted to Kebab case, but now we convert to Kebab case as well as React. a036181
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
Multiple uses of children
It did not work correctly when children were used multiple times within a single component, as in the following test case, which has been fixed.
https://github.com/usualoma/hono/blob/8f6639f218c768beae414a78d13271d86e6007b5/src/jsx/dom/index.test.tsx#L439-L444
b19749b
Cautions for updating
I don't think there is a breaking change since it is the addition of one hook and a minor bug fix. However, for 8974135, there is a slight possibility that "previously the bug resulted in the expected result, but the correction results in an unexpected result". Therefore, I think this should be in the minor release, not in the patch release.
What did I use to verify?
https://ui.shadcn.com/docs/components/toast
https://ui.shadcn.com/docs/components/tooltip
These two UI components were verified in the following repositories
https://github.com/usualoma/hono-react-compat-demo
The author should do the following, if applicable
bun denoify
to generate files for Denobun run format:fix && bun run lint:fix
to format the code