()
| 16 | * Reset all Zustand stores and React Query caches to initial state. |
| 17 | */ |
| 18 | export const resetAllStores = () => { |
| 19 | useWorkflowRegistry.setState({ |
| 20 | activeWorkflowId: null, |
| 21 | error: null, |
| 22 | hydration: { |
| 23 | phase: 'idle', |
| 24 | workspaceId: null, |
| 25 | workflowId: null, |
| 26 | requestId: null, |
| 27 | error: null, |
| 28 | }, |
| 29 | }) |
| 30 | useWorkflowStore.getState().clear() |
| 31 | useSubBlockStore.getState().clear() |
| 32 | getQueryClient().removeQueries({ queryKey: environmentKeys.all }) |
| 33 | useExecutionStore.getState().reset() |
| 34 | useTerminalConsoleStore.setState({ |
| 35 | workflowEntries: {}, |
| 36 | entryIdsByBlockExecution: {}, |
| 37 | entryLocationById: {}, |
| 38 | isOpen: false, |
| 39 | }) |
| 40 | consolePersistence.persist() |
| 41 | useMothershipDraftsStore.setState({ drafts: {} }) |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Clear all user data when signing out. |
no test coverage detected