fix animation
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user