react-dd-menu
react-dd-menu copied to clipboard
Invoke `props.close` on unmount
Would it make sense to invoke props.close in componentWillUnmount? Currently I render x amount of dropdowns in a component. These dropdowns' open/closed state are kept in global state. These dropdowns can also be arbitrarily removed in real-time via websocket events. When they are removed when they are open, it'll keep its global state as open. By having DropdownMenu invoke props.close in unmount I can "circumvent" this.
I can work around this by creating a wrapper component for DropdownMenu that handles this, but was wondering if you thought it'd be a good idea to keep it in this component?
I think this would be a good addition as long as there is a simple check making sure isOpen is true before calling it. I'll be happy to merge it in and add a patch with it if a pull request is created