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

Add safer refresh on InteractiveExample #6057

Merged

Conversation

patrycjakalinska
Copy link
Collaborator

@patrycjakalinska patrycjakalinska commented May 28, 2024

Before when page was loading, there was a chance that width value wouldn't be passed to component in InteractiveComponent - in other words the width will be passed to component before it had become something other than null, and there won't be a rerender after width gets a number value. After this change, with useEffect hook, we monitor if width has changed and if so, we trigger a rerender that guarantees our component will always get correct width.

Copy link
Member

@kacperkapusciak kacperkapusciak 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!

sidenote: Shouldn't the InteractiveExample be a part of T-rex as well? We've started to use it in RNGH as well. Just asking

@patrycjakalinska patrycjakalinska added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 4cd7505 May 28, 2024
8 checks passed
@patrycjakalinska patrycjakalinska deleted the @patrycjakalinska/refresh-on-interactive-example branch May 28, 2024 09:42
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.

None yet

2 participants