-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
useResponsiveProps: Fixes default breakpoint prop value assignment #281
Conversation
Hi, @ruhaise. Could you please take a look at this pull request? I've tried to address the issue you were fixing in #276 using a custom matching function during responsive props filtering. Tests pass, but I've found out that we cannot currently handle the "down" behavior, if it affects the default breakpoint also (see the skipped test for |
081f909
to
d1797ab
Compare
d460c13
to
2c20c27
Compare
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.
i had no clue how to remove the approval state
@ruhaise, I'm not sure what's the issue. I've requested another review from you, so feel free to approve or request changes with commenting on places you think can be improved. Thanks! |
I think I'll file a separate issue regarding how the "down" behavior is handled. The thing is that this issue is reproducible even in the latest release, so it can be tackled separately if its complexity is too high for this pull request. I'd rather spend some time thinking how to approach this. |
@kettanaito approved and added a very minor comment |
2c20c27
to
c5754e9
Compare
Changes
useResponsiveProps
When rendered on a server no React hooks are run. The
useEffect
hook inuseResponsiveProps
is no exception, and this results into server-side markup containing no props at all, because the initial state of the respectiveuseState
hook is undefined. To prevent this, I make the filtering function parametric and call it with a server-side-like matcher as the initial value of theuseState
hook.useResponsiveComponent
functionGitHub
Release version
Contributor's checklist
master
yarn verify
and verified the build and tests passing