fix animation

This commit is contained in:
Hamid
2026-05-16 04:50:17 -07:00
parent 75c9a2515b
commit 0628340a5d
3 changed files with 88 additions and 86 deletions
+9 -3
View File
@@ -23,7 +23,7 @@ const Editor: FC = () => {
}, [])
const [isLayersPanelOpen, setIsLayersPanelOpen] = useState(false)
const [isInitialContentReady, setIsInitialContentReady] = useState(false)
const { loadPages, pages, documentSettings } = useEditorStore()
const { loadPages, pages, documentSettings, objects, currentPageId } = useEditorStore()
const { data, isFetched } = useGetCatalogById(id!)
const { scheduleUpdate, isSaving } = useUpdateCatalog()
@@ -51,13 +51,19 @@ const Editor: FC = () => {
if (!isInitialContentReady) return
if (!pages || pages.length === 0) return
const pagesToSave = currentPageId
? pages.map((p) =>
p.id === currentPageId ? { ...p, objects } : p,
)
: pages
scheduleUpdate({
id,
content: JSON.stringify({ pages, documentSettings }),
content: JSON.stringify({ pages: pagesToSave, documentSettings }),
})
// عمداً scheduleUpdate را در وابستگی‌ها نیاوردیم تا از لوپ ذخیره‌سازی جلوگیری شود
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, isInitialContentReady, pages, documentSettings])
}, [id, isInitialContentReady, pages, documentSettings, objects, currentPageId])
return (