react-dd-menu icon indicating copy to clipboard operation
react-dd-menu copied to clipboard

Invoke `props.close` on unmount

Open williamboman opened this issue 8 years ago • 1 comments

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?

williamboman avatar Aug 16 '17 10:08 williamboman

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

mlaursen avatar Aug 21 '17 11:08 mlaursen