mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
added back sync logic
This commit is contained in:
@@ -285,6 +285,24 @@ export async function fetchWorkflowsFromDB(): Promise<void> {
|
||||
})
|
||||
})
|
||||
|
||||
// Get any additional subblock values that might not be in the state but are in the store
|
||||
const storedValues = useSubBlockStore.getState().workflowValues[id] || {}
|
||||
Object.entries(storedValues).forEach(([blockId, blockValues]) => {
|
||||
if (!subblockValues[blockId]) {
|
||||
subblockValues[blockId] = {}
|
||||
}
|
||||
|
||||
Object.entries(blockValues).forEach(([subblockId, value]) => {
|
||||
// Only update if not already set or if value is null
|
||||
if (
|
||||
subblockValues[blockId][subblockId] === null ||
|
||||
subblockValues[blockId][subblockId] === undefined
|
||||
) {
|
||||
subblockValues[blockId][subblockId] = value
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 4. Store the workflow state and subblock values in localStorage
|
||||
// This ensures compatibility with existing code that loads from localStorage
|
||||
localStorage.setItem(`workflow-${id}`, JSON.stringify(workflowState))
|
||||
|
||||
Reference in New Issue
Block a user