[web] Fix issue when opening menu without closing the previous
Summary:
Fix problem described here:
https://linear.app/comm/issue/ENG-1125/opening-new-menu-without-closing-the-previous-one-doesnt-work
The source of the problem was closeMenu function provided by menu context, that cleared menu symbol just after it was updated by other menu component.
The diff introduces the following changes in the API:
- closeMenu parameter is now menu symbol instead of node - it makes API more consistent, as setCurrentOpenMenu already operated with symbol.
- closeMenu before clearing the menu, now checks if if was called from component that is active at the moment and clear menu only in that case.
- to simplify managing state, menu node and symbol are merged into single state with one object inside. The main reason was to avoid executing setMenu inside callback passed to setCurrentMenu. In result, separate setMenuSumbol and setMenuNode functions were introduced, to avoid API changes.
Test Plan: Open members modal and open two menus in a row without closing first one. The issue should no longer exists.
Reviewers: palys-swm, atul, benschac, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, Adrian, atul, yayabosh
Differential Revision: https://phabricator.ashoat.com/D4034