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: fixes issue where sidebar default state always starts as closed #3672

Merged

Conversation

FredrikMWold
Copy link
Contributor

This PR addresses a bug in the sidebar component where setting the open state to true by default results in an initial layout shift. The component briefly renders as closed before opening, causing an unwanted animation.

Issue

The issue stems from using a useEffect to sync the internal state with the open prop, leading to a mismatch on initial render.

Fix

The internal state now defaults directly to the open prop, ensuring the sidebar renders correctly without unnecessary transitions.

Copy link
Collaborator

@oddvernes oddvernes left a comment

Choose a reason for hiding this comment

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

Lgtm!

@oddvernes oddvernes merged commit a44ad6b into equinor:develop Nov 8, 2024
4 of 6 checks passed
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