diff --git a/resources/js/modules/editor/editor.jsx b/resources/js/modules/editor/editor.jsx index 407be4b..b4271d5 100644 --- a/resources/js/modules/editor/editor.jsx +++ b/resources/js/modules/editor/editor.jsx @@ -107,8 +107,8 @@ const useResponsiveDimensions = () => { return dimensions; }; -const Editor = () => { - const { init } = useMediaStore(); +const Editor = ({ setInitialMeme, setInitialBackground, setInitialText }) => { + const { init, setInitialMeme: setStoreMeme, setInitialBackground: setStoreBackground, setInitialText: setStoreText } = useMediaStore(); const { getSetting } = useLocalSettingsStore(); const { setSelectedTextElement } = useVideoEditorStore(); const emitter = useMitt(); @@ -121,8 +121,20 @@ const Editor = () => { const isBelowMinWidth = useViewportDetection(320); useEffect(() => { + // Set initial values if props are provided + if (setInitialMeme) { + setInitialMeme(setStoreMeme); + } + if (setInitialBackground) { + setInitialBackground(setStoreBackground); + } + if (setInitialText) { + setInitialText(setStoreText); + } + + // Initialize (will skip API call if initial values were set) init(); - }, []); + }, [setInitialMeme, setInitialBackground, setInitialText, setStoreMeme, setStoreBackground, setStoreText, init]); // Listen for text element selection (but don't auto-open sidebar) useEffect(() => { diff --git a/resources/js/pages/home/home.tsx b/resources/js/pages/home/home.tsx index 877e0b5..82bb6f9 100644 --- a/resources/js/pages/home/home.tsx +++ b/resources/js/pages/home/home.tsx @@ -33,6 +33,7 @@ const Home = ({ faqData }) => {