From 9c71673b506f35274cadb252d7d4d063d14dac76 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:19:23 +0300 Subject: [PATCH] B: Fix editor modified status --- .../src/features/rsform/pages/rsform-page/rstabs.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rsconcept/frontend/src/features/rsform/pages/rsform-page/rstabs.tsx b/rsconcept/frontend/src/features/rsform/pages/rsform-page/rstabs.tsx index 6d3c3e67..2e93bc45 100644 --- a/rsconcept/frontend/src/features/rsform/pages/rsform-page/rstabs.tsx +++ b/rsconcept/frontend/src/features/rsform/pages/rsform-page/rstabs.tsx @@ -24,7 +24,6 @@ export function RSTabs({ activeID, activeTab }: RSTabsProps) { const router = useConceptNavigation(); const hideFooter = useAppLayoutStore(state => state.hideFooter); - const isModified = useModificationStore(state => state.isModified); const setIsModified = useModificationStore(state => state.setIsModified); const { schema, selected, setSelected, deselectAll, navigateRSForm } = useRSEdit(); @@ -36,14 +35,12 @@ export function RSTabs({ activeID, activeTab }: RSTabsProps) { }; }, [schema.title]); + useLayoutEffect(() => setIsModified(false), [activeID, setIsModified]); + useLayoutEffect(() => { const nextNoFooter = activeTab !== RSTabID.CARD; hideFooter(nextNoFooter); - if (isModified) { - setIsModified(false); - } - if (activeTab === RSTabID.CST_EDIT) { let nextSelected: number[] = []; if (activeID && schema.cstByID.has(activeID)) { @@ -65,7 +62,7 @@ export function RSTabs({ activeID, activeTab }: RSTabsProps) { } } } - }, [activeTab, activeID, selected, schema, hideFooter, isModified, setIsModified, setSelected, deselectAll]); + }, [activeTab, activeID, selected, schema, hideFooter, setSelected, deselectAll]); useLayoutEffect(() => { return () => hideFooter(false); @@ -75,6 +72,7 @@ export function RSTabs({ activeID, activeTab }: RSTabsProps) { if (last === index) { return; } + setIsModified(false); if (event.type == 'keydown') { const kbEvent = event as KeyboardEvent; if (kbEvent.altKey) {