-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Fix/media query default breakpoint unused #5638
Fix/media query default breakpoint unused #5638
Conversation
🦋 Changeset detectedLatest commit: 84ca354 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/4nY5VVPxxpqx2mk8EHYhGCLVDPUt |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 84ca354:
|
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.
Thank you for this PR @ishowta 💖
Especially for the updated test suite!
Thank you again for you work @ishowta I used the changes to fix another SSR / CSR issue with the useBreakpointValue hook. Your commits + history are still intact and all credits are going to you for fixing this bug! @all-contributors please add @ishowta for code. |
I've put up a pull request to add @ishowta! 🎉 |
📝 Description
Since
matchMedia
always returnsfalse
during SSR, the code to checkdefaultBreakpoint
was not reached by this refactorAlso, the test was not able to set up the same situation as SSR, so it was not failed.
chakra-ui/packages/media-query/src/use-breakpoint.ts
Lines 27 to 45 in 60fc221
⛳️ Current behavior (updates)
Always return undefined during SSR
🚀 New behavior
return
defaultValue
when SSR💣 Is this a breaking change (Yes/No):
No
📝 Additional Information