SMAPI doesn't detect menu changes inside menu event handlers
Pathoschild opened this issue · 1 comments
When SMAPI detects a menu change, it notifies all mods and then sets PreviousMenu
to the current active menu. If a mod changes the menu again in a menu event handler, SMAPI doesn't notice the change and doesn't raise a new event. This can lead to scenarios like this:
what happened | event raised |
---|---|
Menu A opened. | ✓ MenuChangedEvent |
Menu B opened. | ✓ MenuChangedEvent |
Menu B closed. | ✓ MenuClosedEvent |
Menu A opened (inside a MenuClosedEvent handler). |
✘ no event raised |
That scenario occurs frequently with some mods. For example:
- View a chest with Chests Anywhere.
- Lookup any item with Lookup Anything.
- Close the lookup UI.
- The chest UI is reopened, but the Chests Anywhere is not re-added (since the mod wasn't notified).