Skip to content

Commit 8734411

Browse files
Adam GoughAdam Gough
authored andcommitted
added back sync logic
1 parent 7080b9e commit 8734411

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

apps/sim/stores/workflows/sync.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,24 @@ export async function fetchWorkflowsFromDB(): Promise<void> {
285285
})
286286
})
287287

288+
// Get any additional subblock values that might not be in the state but are in the store
289+
const storedValues = useSubBlockStore.getState().workflowValues[id] || {}
290+
Object.entries(storedValues).forEach(([blockId, blockValues]) => {
291+
if (!subblockValues[blockId]) {
292+
subblockValues[blockId] = {}
293+
}
294+
295+
Object.entries(blockValues).forEach(([subblockId, value]) => {
296+
// Only update if not already set or if value is null
297+
if (
298+
subblockValues[blockId][subblockId] === null ||
299+
subblockValues[blockId][subblockId] === undefined
300+
) {
301+
subblockValues[blockId][subblockId] = value
302+
}
303+
})
304+
})
305+
288306
// 4. Store the workflow state and subblock values in localStorage
289307
// This ensures compatibility with existing code that loads from localStorage
290308
localStorage.setItem(`workflow-${id}`, JSON.stringify(workflowState))

0 commit comments

Comments
 (0)