๐ Menu Bar Items Not Updating
knotbin opened this issue ยท 3 comments
Description
Menu bar items' text and disabled state do not update unless you exit and reenter window. Menu bar items that should toggle between "Show ___" and "Hide ___" simply stay in their original state until you exit and reenter the window. The same is true for disabled commands that are eligible to enable, but do not until you exit and reenter the window.
To Reproduce
- Go to menu bar
- Click on View (this is used for example, the bug is present in all menu items)
- Click on Hide Navigator/Show Navigator
- Click on View again
The button will not have changed (from Hide Navigator to show Navigator or vice versa.) - Exit the window by clicking on any other window or your desktop
- Re-enter the window
- Click on View in the menu bar
The button will now have updated
Expected Behavior
When you click on a button - hide navigator for example - it will change states - changing to show navigator - without the need to exit and reenter the window.
Version Information
CodeEdit: [0.2]
macOS: [14.4.1]
Xcode: [15.3]
Additional Context
No response
Screenshots
8307d098-05a1-4c96-a3ad-5ff14e20f5f7.mp4
Possible cause:
These Command files take in ObservableObjects using @State instead of @StateObject, which would cause the entire view to reload whenever it is changed, rather than @State which does not reload the entire view after changes. Transitioning to using @StateObject may be the solution.
Hm, just changing
@State var windowController: CodeEditWindowController?
to
@StateObject var windowController: CodeEditWindowController?
Throws an error, since we're applying StateObject to an optional type; is there an elegant workaround for this?
@austincondiff can I be assigned to this issue? I think I should be able to fix #1696 as well, just a few minor tweaks needed