mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-12 19:57:37 +00:00
fix: leave editor after deleting the open stack (#1665)
* fix: leave editor after deleting the open stack Clear selection on delete-key identity match, navigate to dashboard only when the editor is visible, and clear mobile detail so the URL writer leaves the deleted stack route instead of a permanent skeleton. * fix: remove duplicate setIsFileLoading in stack actions test fixture
This commit is contained in:
@@ -208,6 +208,10 @@ export default function EditorLayout() {
|
||||
// useViewNavigationState needs onNavigateToDashboard -> resetEditorState
|
||||
// but stackActions isn't created until after navState
|
||||
const resetEditorStateRef = useRef<() => void>(() => {});
|
||||
// Mobile state is declared after useStackActions; this ref is assigned once
|
||||
// pendingDetailStack / mobileView exist so delete-of-open-stack can flip to
|
||||
// the list surface without reordering the hook graph.
|
||||
const onDeletedOpenStackRef = useRef<() => void>(() => {});
|
||||
|
||||
const navState = useViewNavigationState({
|
||||
onNavigateToDashboard: () => resetEditorStateRef.current(),
|
||||
@@ -282,6 +286,7 @@ export default function EditorLayout() {
|
||||
return can('stack:edit', 'stack', stackName);
|
||||
},
|
||||
canOfferVolumeRemoval,
|
||||
onDeletedOpenStack: () => onDeletedOpenStackRef.current(),
|
||||
});
|
||||
|
||||
// Wire the ref now that stackActions is available
|
||||
@@ -375,6 +380,10 @@ export default function EditorLayout() {
|
||||
const [pendingDetailStack, setPendingDetailStack] = useState<string | null>(null);
|
||||
const [pendingAnatomyTab, setPendingAnatomyTab] = useState<'networking' | 'doctor' | 'dossier' | 'drift' | undefined>();
|
||||
const [fleetUpdatesIntent, setFleetUpdatesIntent] = useState<{ tab: 'nodes' | 'changelog' } | null>(null);
|
||||
onDeletedOpenStackRef.current = () => {
|
||||
setPendingDetailStack(null);
|
||||
setMobileView('list');
|
||||
};
|
||||
|
||||
const handleFleetUpdatesIntentConsumed = useCallback(() => setFleetUpdatesIntent(null), []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user