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

[docs] Fix hydration issue for Video component #25072

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

amandeepmittal
Copy link
Member

@amandeepmittal amandeepmittal commented Oct 27, 2023

Why

After upgrading react-player dependency to the latest, the following hydration issue started occurring where we use Video component.

image

I found a similar open issue in React Player GitHub repo (cookpete/react-player#1474) where it states that the library is not SSR friendly and this issue happens with React 18.

How

Apply the workaround suggested here which implies to lazy load the player using Next.js dynamic imports.

Test Plan

Tested this locally and there doesn't seem to be the hydration error on docs where we use the Video component.

To test it locally, run docs locally and go to: http://localhost:3002/develop/development-builds/introduction/

Checklist

@amandeepmittal amandeepmittal requested a review from Simek as a code owner October 27, 2023 07:41
@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Oct 27, 2023
Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks for figuring out the fix! 👍

@amandeepmittal amandeepmittal merged commit c6ed469 into main Oct 27, 2023
4 checks passed
@amandeepmittal amandeepmittal deleted the aman/fix-hydration-issue-video-component branch October 27, 2023 10:45
marklawlor pushed a commit that referenced this pull request Oct 30, 2023
# Why

<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->

After upgrading `react-player` dependency to the latest, the following
hydration issue started occurring where we use `Video` component.


![image](https://github.com/expo/expo/assets/10234615/62b3b8f9-7788-468a-a0a1-2a4793236060)


I found a similar open issue in React Player GitHub repo
(cookpete/react-player#1474) where it states
that the library is not SSR friendly and this issue happens with React
18.

# How

<!--
How did you build this feature or fix this bug and why?
-->

Apply the workaround suggested
[here](cookpete/react-player#1474 (comment))
which implies to lazy load the player using Next.js dynamic imports.

# Test Plan

<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->

Tested this locally and there doesn't seem to be the hydration error on
docs where we use the `Video` component.

To test it locally, run docs locally and go to:
http://localhost:3002/develop/development-builds/introduction/

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants