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

onSelection does not update #142

Closed
ajkovar opened this issue Nov 19, 2020 · 3 comments · Fixed by #151
Closed

onSelection does not update #142

ajkovar opened this issue Nov 19, 2020 · 3 comments · Fixed by #151

Comments

@ajkovar
Copy link

ajkovar commented Nov 19, 2020

onSelection is being fed into the manager object on init:

https://github.com/davidtheclark/react-aria-menubutton/blob/master/src/Wrapper.js#L26

If this prop later changes, it does not update in the component.

@ainursharaev
Copy link

ainursharaev commented Apr 5, 2021

For a while, I decided to force-update a whole select component via key prop, which takes a variable that makes the onSelect different

@ekilah
Copy link
Contributor

ekilah commented Jul 7, 2021

This just bit me and it was a tricky bug to narrow down! Props should never be saved like this in React in a constructor without being updated in lifecycle methods like componentDidUpdate or getDerivedStateFromProps

@ekilah
Copy link
Contributor

ekilah commented Jul 8, 2021

Added a fix for this in #151

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 a pull request may close this issue.

3 participants