diff --git a/visual_workflow_builder/frontend_v4/src/components/CapturePanel.tsx b/visual_workflow_builder/frontend_v4/src/components/CapturePanel.tsx index 0cd32c788..9d6b26eb3 100644 --- a/visual_workflow_builder/frontend_v4/src/components/CapturePanel.tsx +++ b/visual_workflow_builder/frontend_v4/src/components/CapturePanel.tsx @@ -64,6 +64,7 @@ export default function CapturePanel({ const [previewScale, setPreviewScale] = useState({ x: 1, y: 1 }); const isDebugMode = executionMode === 'debug'; + const [libraryLoaded, setLibraryLoaded] = useState(false); // Charger la bibliotheque depuis le backend (prioritaire), fallback localStorage. useEffect(() => { @@ -77,13 +78,16 @@ export default function CapturePanel({ : item.timestamp, })) ); + setLibraryLoaded(true); }); }, []); - // Sauvegarder la bibliotheque (localStorage + backend) + // Sauvegarder la bibliotheque SEULEMENT après le chargement initial useEffect(() => { - saveLibrary(library); - }, [library]); + if (libraryLoaded) { + saveLibrary(library); + } + }, [library, libraryLoaded]); // Ajouter capture a la bibliotheque (thumbnail compresse JPEG 320x240) useEffect(() => {