Skip to content

Conversation

@Anthony-Eid
Copy link
Contributor

@Anthony-Eid Anthony-Eid commented Oct 23, 2025

Closes #40351

The leak mainly showed up in the appearance page because it had a lot of dropdown menus. The problem occurred because the drop-down menus were creating a new entity on each frame instead of using the window.use_state... API.

Release Notes:

  • settings ui: Fixed memory leak in UI

The leak mainly showed up in the appearance page because it had a lot of
dropdown menus. The problem occurred because the drop down menus were
creating a new entity on each frame instead of using the
window.use_state... api.

Co-authored-by: Mikayla Maki <[email protected]>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 23, 2025
Co-authored-by: Mikayla Maki <[email protected]>
@Anthony-Eid Anthony-Eid enabled auto-merge (squash) October 23, 2025 18:04
@Anthony-Eid Anthony-Eid merged commit f0ac54e into main Oct 23, 2025
37 of 39 checks passed
@Anthony-Eid Anthony-Eid deleted the settings-ui-fix-memory-leak branch October 23, 2025 21:31
probably-neb added a commit that referenced this pull request Nov 4, 2025
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
ConradIrwin pushed a commit that referenced this pull request Nov 4, 2025
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
probably-neb added a commit that referenced this pull request Nov 4, 2025
Cherry-pick of #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

Co-authored-by: Ben Kunkle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak and Cpu engaged

2 participants