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.