# git_ui: Keep view options menu state fresh \(\#59744\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d753a31db53e40c47cfb59964102f07c5493eb4f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d753a31db53e40c47cfb59964102f07c5493eb4f

Requested commit: d753a31db53e40c47cfb59964102f07c5493eb4f

Commit: d753a31db53e40c47cfb59964102f07c5493eb4f

Tree: 6155a111e17d9ec36a0bcedc68707d0c892b2ca2

Author: Sathwik Chirivelli

Committer: GitHub

## Message

```
git_ui: Keep view options menu state fresh (#59744)

# Objective

- Keep the Git panel view options menu open when changing view, sort, or
group options.
- Make the open menu reflect the selected option immediately, including
showing the Sort By section as soon as List view is selected.

## Solution

- Use a persistent context menu for the Git panel view options menu so
selecting an item rebuilds the menu instead of dismissing it.
- Track the open menu's view options state locally with
`GitPanelViewOptionsMenuState` so checkmarks and conditional sections
update before the settings file change is observed.
- Continue dispatching the existing Git panel actions so persisted
settings and panel updates keep using the current code path.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

- N/A

---

Release Notes:

- Fixed Git Panel view options menu selections updating only after
reopening the menu.
```

## Parents

- [d3756f3025d958854c3dd023db17200642a90abe](https://git.cafe/gitcafe/zed/commit/d3756f3025d958854c3dd023db17200642a90abe?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d753a31db53e40c47cfb59964102f07c5493eb4f?format=markdown)
