fix(settings): leave user manage view when switching admin sections (#1649)

The admin panel stays mounted across Settings pages, so an open user
manage view kept replacing every other admin section until Back to users
was clicked. Reset it whenever the selected section changes.
This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-10-15 14:55:00 +08:00
1 parent 694dc34b19
commit bc74fba3f5
2 files changed
+119

No files matched your search

+6
View File
@@ -217,6 +217,12 @@ export function AdminSettingsPanel({
setUserPage(0);
}, [userSearch]);
// The panel stays mounted across Settings pages, so an open user view
// would otherwise replace whichever section is picked next.
useEffect(() => {
setManageUser(null);
}, [section]);
useEffect(() => {
onEditingChange?.(manageUser !== null);
return () => onEditingChange?.(false);