Update
This commit is contained in:
@@ -108,7 +108,7 @@ const useResponsiveDimensions = () => {
|
||||
};
|
||||
|
||||
const Editor = ({ setInitialMeme, setInitialBackground, setInitialText }) => {
|
||||
const { init, setInitialMeme: setStoreMeme, setInitialBackground: setStoreBackground, setInitialText: setStoreText } = useMediaStore();
|
||||
const { init, setInitialMeme: setStoreMeme, setInitialBackground: setStoreBackground, setInitialText: setStoreText, clearInitialState } = useMediaStore();
|
||||
const { getSetting } = useLocalSettingsStore();
|
||||
const { setSelectedTextElement } = useVideoEditorStore();
|
||||
const emitter = useMitt();
|
||||
@@ -121,6 +121,9 @@ const Editor = ({ setInitialMeme, setInitialBackground, setInitialText }) => {
|
||||
const isBelowMinWidth = useViewportDetection(320);
|
||||
|
||||
useEffect(() => {
|
||||
// Clear any previous initial state to allow fresh initialization
|
||||
clearInitialState();
|
||||
|
||||
// Set initial values if props are provided
|
||||
if (setInitialMeme) {
|
||||
setInitialMeme(setStoreMeme);
|
||||
@@ -134,7 +137,12 @@ const Editor = ({ setInitialMeme, setInitialBackground, setInitialText }) => {
|
||||
|
||||
// Initialize (will skip API call if initial values were set)
|
||||
init();
|
||||
}, [setInitialMeme, setInitialBackground, setInitialText, setStoreMeme, setStoreBackground, setStoreText, init]);
|
||||
|
||||
// Cleanup: Clear initial state when component unmounts
|
||||
return () => {
|
||||
clearInitialState();
|
||||
};
|
||||
}, [setInitialMeme, setInitialBackground, setInitialText, setStoreMeme, setStoreBackground, setStoreText, init, clearInitialState]);
|
||||
|
||||
// Listen for text element selection (but don't auto-open sidebar)
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user