davidtheclark / react-aria-menubutton

A fully accessible, easily themeable, React-powered menu button

Home Page:https://davidtheclark.github.io/react-aria-menubutton/demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onSelection does not update

ajkovar opened this issue · comments

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.

commented

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

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

Added a fix for this in #151