# settings_ui: Fix dropdowns after \#41036 \(\#41920\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d8655f06566c5318260ac7a4ee6dc17b20faea3d

Requested commit: d8655f06566c5318260ac7a4ee6dc17b20faea3d

Commit: d8655f06566c5318260ac7a4ee6dc17b20faea3d

Tree: 2789a7689533c0fed8533712c9e747e4e14750d1

Author: Ben Kunkle

Committer: GitHub

## Message

```
settings_ui: Fix dropdowns after #41036 (#41920)

Closes #41533

Both of the issues in the release notes that are fixed in this PR, were
caused by incorrect usage of the `window.use_state` API.
The first issue was caused by calling `window.use_state` in a render
helper, resulting in the element ID used to share state being the same
across different pages, resulting in the state being re-used when it
should have been re-created. The fix for this was to move the
`window.state` (and rendering logic) into a `impl RenderOnce` component,
so that the IDs are resolved during the render, avoiding the state
conflicts.

The second issue is caused by using a `move` closure in the
`window.use_state` call, resulting in stale closure values when the
window state is re-used.

Release Notes:

- settings_ui: Fixed an issue where some dropdown menus would show
options from a different dropdown when clicked
- settings_ui: Fixed an issue where attempting to change a setting in a
dropdown back to it's original value after changing it would do nothing
```

## Parents

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

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