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

pkp/pkp-lib#9890 Add useSideMenu composable #393

Merged
merged 3 commits into from
Aug 19, 2024

Conversation

blesildaramirez
Copy link
Collaborator

No description provided.

localExpandedKeys.value = {...newExpandedKeys};
},
);

Copy link
Collaborator

@jardakotesovec jardakotesovec Aug 19, 2024

Choose a reason for hiding this comment

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

When managing state in components, I think its always good to answer clearly - who is owning the state. Sometime its parent sometime its the children. But it gets difficult if its something in between to reason about it.

In this case SideMenu is owning the state, but you can impact it via props. When props gets changed it merges changes in props with original state and you get something in between.

What I had in mind is that parent would own the state using the useSideMenu composable. That would be source of the truth - and SideMenu component would just strictly display the state its receiving via props. Without handling its own state that would be synchronised with props.

That also allow more powerful api that I was asking for - like expandAll.

@jardakotesovec jardakotesovec merged commit 83820ab into pkp:main Aug 19, 2024
3 of 5 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