Skip to content

fix(site): sync rename dialog state in template editor#24501

Draft
aslilac wants to merge 1 commit intomainfrom
lilac/fix-rename-dialog-state
Draft

fix(site): sync rename dialog state in template editor#24501
aslilac wants to merge 1 commit intomainfrom
lilac/fix-rename-dialog-state

Conversation

@aslilac
Copy link
Copy Markdown
Member

@aslilac aslilac commented Apr 17, 2026

The rename dialog in the template files editor never showed the current filename in the input field. RenameFileDialog stays mounted for the lifetime of the editor, so useState(filename) only captured the initial empty value and never updated when a different file was selected for renaming.

Track the previous filename prop and reset pathValue during render when it changes.

Note

Generated by Coder Agents

The RenameFileDialog is always mounted (MUI Dialog does not unmount
children when closed), so useState(filename) only captures the
initial value on first mount. Because the dialog initially mounts
with an empty filename, every subsequent open showed a stale empty
input rather than the current file path.

Track the previous filename prop and reset pathValue during render
when it changes, following the React 'adjusting state during render'
pattern instead of useEffect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant