mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2025-12-24 06:58:48 -05:00
fix: preserve connector persistence without breaking image export
The deep comparison logic from commit2733f0bprevented the export dialog's Isoflow instance from properly initializing. Now bypasses the comparison check when in NON_INTERACTIVE mode (used for export). Testing process: - Bisected commits to identify2733f0bas the breaking change - Tested working commit8db2710vs broken commit2733f0b- Confirmed deep comparison was preventing initialization - Implemented conditional check based on editor mode - Verified export now works while connector persistence is maintained Fixed it and will in future not be a massive idiot and will properly test things -stan
This commit is contained in:
@@ -105,8 +105,15 @@ export const ExportImageDialog = ({ onClose, quality = 1.5 }: Props) => {
|
||||
}, 100);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [showGrid, backgroundColor]);
|
||||
|
||||
}, [showGrid, backgroundColor, exportImage]);
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
exportImage();
|
||||
}, 100);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
const downloadFile = useCallback(() => {
|
||||
if (!imageData) return;
|
||||
|
||||
@@ -26,6 +26,9 @@ export const useInitialDataManager = () => {
|
||||
const rendererEl = useUiStateStore((state) => {
|
||||
return state.rendererEl;
|
||||
});
|
||||
const editorMode = useUiStateStore((state) => {
|
||||
return state.editorMode;
|
||||
});
|
||||
const { changeView } = useView();
|
||||
|
||||
const load = useCallback(
|
||||
@@ -33,7 +36,8 @@ export const useInitialDataManager = () => {
|
||||
if (!_initialData || prevInitialData.current === _initialData) return;
|
||||
|
||||
// Deep comparison to prevent unnecessary reloads when data hasn't actually changed
|
||||
if (prevInitialData.current) {
|
||||
// Skip this check for NON_INTERACTIVE mode (used by export) to ensure proper initialization
|
||||
if (prevInitialData.current && editorMode !== 'NON_INTERACTIVE') {
|
||||
const prevConnectors = JSON.stringify(prevInitialData.current.views?.[0]?.connectors || []);
|
||||
const newConnectors = JSON.stringify(_initialData.views?.[0]?.connectors || []);
|
||||
const prevItems = JSON.stringify(prevInitialData.current.items || []);
|
||||
@@ -111,7 +115,7 @@ export const useInitialDataManager = () => {
|
||||
|
||||
setIsReady(true);
|
||||
},
|
||||
[changeView, model.actions, rendererEl, uiStateActions]
|
||||
[changeView, model.actions, rendererEl, uiStateActions, editorMode]
|
||||
);
|
||||
|
||||
const clear = useCallback(() => {
|
||||
|
||||
Reference in New Issue
Block a user