fix: add key prop to RoleEditView to reset state when switching roles

RoleEditView used useState(role.name) for draft state, but React
reuses the component instance when editingRoleId changes, ignoring
the new initial value. Adding key={editingRoleId} forces a remount,
re-initializing all draft state (name, color, permissions) correctly.
This commit is contained in:
Jannis Braun
2026-03-21 23:43:00 +01:00
parent 09bfd1ccab
commit da82ba6d94
@@ -112,6 +112,7 @@ export function RolesPanel({ spaceId }: RolesPanelProps) {
}
return (
<RoleEditView
key={editingRoleId}
role={role}
spaceId={spaceId}
onBack={() => setEditingRoleId(null)}