Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶 Menu Bar Items Not Updating #1684

Closed
knotbin opened this issue Apr 24, 2024 · 3 comments 路 Fixed by #1697
Closed

馃悶 Menu Bar Items Not Updating #1684

knotbin opened this issue Apr 24, 2024 · 3 comments 路 Fixed by #1697
Assignees
Labels

Comments

@knotbin
Copy link
Contributor

knotbin commented Apr 24, 2024

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

  1. Go to menu bar
  2. Click on View (this is used for example, the bug is present in all menu items)
  3. Click on Hide Navigator/Show Navigator
  4. Click on View again
    The button will not have changed (from Hide Navigator to show Navigator or vice versa.)
  5. Exit the window by clicking on any other window or your desktop
  6. Re-enter the window
  7. 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
@knotbin knotbin added the bug Something isn't working label Apr 24, 2024
@knotbin
Copy link
Contributor Author

knotbin commented Apr 24, 2024

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.

@danielzsh
Copy link
Contributor

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?

@danielzsh
Copy link
Contributor

@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

thecoolwinter pushed a commit that referenced this issue May 16, 2024
### Description

<!--- REQUIRED: Describe what changed in detail -->
The issue is described in detail in #1684.

~I tried to resolve a related issue, #1696, but it was harder than I anticipated since the state of the Utility Area is stored separate to the other panes for some reason. Any ideas to resolve this slight issue would be welcome :)~

**EDIT:** I think I fixed it! 

### Related Issues

<!--- REQUIRED: Tag all related issues (e.g. * #123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes #123) -->
<!--- If this PR addresses multiple issues, these issues must be related to one other -->

* Closes #1684 
* Closes #1696 

### Checklist

<!--- Add things that are not yet implemented above -->

- [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots

<!--- REQUIRED: if issue is UI related -->

https://github.com/CodeEditApp/CodeEdit/assets/65467530/166d9b35-ede1-47b8-8814-cf1cbb1a61f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 馃弫 Complete
Development

Successfully merging a pull request may close this issue.

2 participants