Skip to content
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

Range picker hydration #147

Merged
merged 2 commits into from
Feb 21, 2023
Merged

Range picker hydration #147

merged 2 commits into from
Feb 21, 2023

Conversation

AKaudinov
Copy link
Contributor

@AKaudinov AKaudinov commented Feb 10, 2023

  • Created a new hook: useIsMobile

  • Refactored DateRangePicker to a functional component so
    it can use the new useIsMobile hook when mounting

  • Removed the usage of isMobile layout helper that was trying
    to access the window width directly on React hydration after
    server render, which caused content mismatch issues

    • the new isMobile hook uses useEffect which fires after
      mount, preventing hydration mismatches

Amir Kaudinov added 2 commits February 10, 2023 14:35
- Created a new hook: useIsMobile
   - which executes on the client side
- Refactored DateRangePicker to a functional component so
  it can use the new `useIsMobile` hook when mounting
- Removed the usage of isMobile layout helper that was trying
  to access the window width directly on React hydration after
  server render, which caused different rendered content issues.
   - the new isMobile hook uses `useEffect` which fires after
     mount, preventing hydration mismatches
@AKaudinov AKaudinov self-assigned this Feb 10, 2023
@AKaudinov AKaudinov merged commit 5fe1de3 into next-13-app-dir Feb 21, 2023
@AKaudinov AKaudinov deleted the range-picker-hydration branch February 21, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant