How to dynamically update disabled state in custom menu items after mergeMenu? #4932
Unanswered
anniko-dev
asked this question in
Q&A | 常见问题
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm building a plugin for custom context menu items, and I ran into an issue.
The getOptions function is supposed to dynamically control the disabled state of each menu item depending on the currently selected unit. However, it seems like mergeMenu is only called once during the initial render, and the menuItemFactory does not update afterwards — so the disabled values remain stale.
Here’s the relevant part of my code:
And here’s what getOptions looks like:
Beta Was this translation helpful? Give feedback.
All reactions