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

Custom hook for state management in Transcript component #652

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

Dananji
Copy link
Collaborator

@Dananji Dananji commented Sep 27, 2024

Related issue: #630

This work moves state management in Transcript component to a custom hook.
Since Transcript component is built as an independent component from global state management using context providers it doesn't have the issue other components have with unnecessary re-renders.
But it can be used within context providers, without breaking its independent nature.
This refactor helps up to make use of the global state IF the component is wrapped inside the context providers.
One advantage of this is, Transcript component doesn't need to spin up a unnecessary JS interval to read the player instance from the page when the player is available via context providers, while still supporting its independent implementation.

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

Looks great! I really like how this makes the Transcript component much smaller!

@Dananji Dananji merged commit 9b02c77 into main Sep 30, 2024
2 checks passed
@Dananji Dananji deleted the state-refactor5-630 branch September 30, 2024 16:25
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.

2 participants