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

fix(video-upload): protect react-media-recorder hook from SSR #800

Merged
merged 5 commits into from
Apr 4, 2024

Conversation

connordoman
Copy link
Contributor

Welcome to PrivacyPal! 👋

Fixes: #799

Description of the change:

This change adds a wrapper module for react-media-recorder-2 to prevent the issue with the Worker API not being present during SSR. It does so by dynamically importing the module if the browser context is detected.

Motivation for the change:

While the Worker is not defined error does not effect usage or even build & deployment, testing any route that contains <UploadVideoForm/> will irrevocably fail. This is because the react-media-recorder-2 module is imported at the top of the file, which causes the error to be thrown during the SSR process.

@connordoman connordoman added this to the QA Phase (Week 11 & 12) milestone Apr 3, 2024
@connordoman connordoman added fix Fixes for something broken area/front-end Front-end work QA Quality Assurance labels Apr 3, 2024
@connordoman connordoman self-assigned this Apr 3, 2024
Copy link
Contributor

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

I run the latest container image build on this branch and ran into:

image

Seems like the import promise failed and the recording button is stuck.

Copy link
Contributor

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Looks good!

@tthvo
Copy link
Contributor

tthvo commented Apr 4, 2024

Works well indeed! Thanks for handling this :D

@tthvo tthvo merged commit 30a362c into develop Apr 4, 2024
10 checks passed
@tthvo tthvo deleted the gh-799-fix-worker-not-defined branch April 4, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/front-end Front-end work fix Fixes for something broken QA Quality Assurance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants