-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Components: use the __unsafe_useEmotionCache
in the useCx
hook
#33982
Conversation
if ( cache === null ) { | ||
return ''; | ||
} |
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.
Not sure if there's a better return value in case cache
is null
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.
If the cache
is null I think we should throw an error on line 43. It would indicate that useCx
is being called outside of an Emotion Cache Context which is not valid, right?
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.
Done in 40bd650
(#33982).
Size Change: -60 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
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! One thing to consider (I really think we should probably raise an error in that case rather than silently failing) but otherwise looks good.
if ( cache === null ) { | ||
return ''; | ||
} |
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.
If the cache
is null I think we should throw an error on line 43. It would indicate that useCx
is being called outside of an Emotion Cache Context which is not valid, right?
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 looks good! Thanks!
a59b50b
to
40bd650
Compare
Description
A recent change in Emotion exposed the
__unsafe_useEmotionCache()
hook.This PR updates the package versions of
@emotion/react
and@emotion/cache
and uses this newly exposed function in theuseCx
hook, instead of exposing the privateCacheProvider._context
variable directly.How has this been tested?
useCx
Storybook story)Screenshots
N/A
Types of changes
Refactor
Checklist:
*.native.js
files for terms that need renaming or removal).