mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(debug-mode): remove duplicate debug mode flag (#1714)
This commit is contained in:
committed by
GitHub
parent
5ab482127d
commit
989a77261c
@@ -50,7 +50,6 @@ import {
|
||||
import { useFolderStore } from '@/stores/folders/store'
|
||||
import { useOperationQueueStore } from '@/stores/operation-queue/store'
|
||||
import { usePanelStore } from '@/stores/panel/store'
|
||||
import { useGeneralStore } from '@/stores/settings/general/store'
|
||||
import { useSubscriptionStore } from '@/stores/subscription/store'
|
||||
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
|
||||
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
|
||||
@@ -104,7 +103,6 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
|
||||
const userPermissions = useUserPermissionsContext()
|
||||
|
||||
// Debug mode state
|
||||
const { isDebugModeEnabled, toggleDebugMode } = useGeneralStore()
|
||||
const { isDebugging, pendingBlocks, handleStepDebug, handleCancelDebug, handleResumeDebug } =
|
||||
useWorkflowExecution()
|
||||
|
||||
@@ -874,9 +872,6 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
|
||||
}
|
||||
|
||||
// Start debugging
|
||||
if (!isDebugModeEnabled) {
|
||||
toggleDebugMode()
|
||||
}
|
||||
if (usageExceeded) {
|
||||
openSubscriptionSettings()
|
||||
} else {
|
||||
@@ -887,11 +882,9 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
|
||||
}, [
|
||||
userPermissions.canRead,
|
||||
isDebugging,
|
||||
isDebugModeEnabled,
|
||||
usageExceeded,
|
||||
blocks,
|
||||
handleCancelDebug,
|
||||
toggleDebugMode,
|
||||
handleRunWorkflow,
|
||||
openConsolePanel,
|
||||
])
|
||||
|
||||
@@ -13,7 +13,6 @@ import { useExecutionStore } from '@/stores/execution/store'
|
||||
import { useConsoleStore } from '@/stores/panel/console/store'
|
||||
import { useVariablesStore } from '@/stores/panel/variables/store'
|
||||
import { useEnvironmentStore } from '@/stores/settings/environment/store'
|
||||
import { useGeneralStore } from '@/stores/settings/general/store'
|
||||
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
|
||||
import { mergeSubblockState } from '@/stores/workflows/utils'
|
||||
import { generateLoopBlocks, generateParallelBlocks } from '@/stores/workflows/workflow/utils'
|
||||
@@ -100,7 +99,6 @@ export function useWorkflowExecution() {
|
||||
const { activeWorkflowId, workflows } = useWorkflowRegistry()
|
||||
const { toggleConsole } = useConsoleStore()
|
||||
const { getAllVariables, loadWorkspaceEnvironment } = useEnvironmentStore()
|
||||
const { isDebugModeEnabled } = useGeneralStore()
|
||||
const { getVariablesByWorkflowId, variables } = useVariablesStore()
|
||||
const {
|
||||
isExecuting,
|
||||
@@ -145,11 +143,6 @@ export function useWorkflowExecution() {
|
||||
setExecutor(null)
|
||||
setPendingBlocks([])
|
||||
setActiveBlocks(new Set())
|
||||
|
||||
// Reset debug mode setting if it was enabled
|
||||
if (isDebugModeEnabled) {
|
||||
useGeneralStore.getState().toggleDebugMode()
|
||||
}
|
||||
}, [
|
||||
setIsExecuting,
|
||||
setIsDebugging,
|
||||
@@ -157,7 +150,6 @@ export function useWorkflowExecution() {
|
||||
setExecutor,
|
||||
setPendingBlocks,
|
||||
setActiveBlocks,
|
||||
isDebugModeEnabled,
|
||||
])
|
||||
|
||||
/**
|
||||
@@ -626,11 +618,10 @@ export function useWorkflowExecution() {
|
||||
}
|
||||
} else if (result && 'success' in result) {
|
||||
setExecutionResult(result)
|
||||
if (!isDebugModeEnabled) {
|
||||
setIsExecuting(false)
|
||||
setIsDebugging(false)
|
||||
setActiveBlocks(new Set())
|
||||
}
|
||||
// Reset execution state after successful non-debug execution
|
||||
setIsExecuting(false)
|
||||
setIsDebugging(false)
|
||||
setActiveBlocks(new Set())
|
||||
|
||||
if (isChatExecution) {
|
||||
if (!result.metadata) {
|
||||
@@ -659,7 +650,6 @@ export function useWorkflowExecution() {
|
||||
getAllVariables,
|
||||
loadWorkspaceEnvironment,
|
||||
getVariablesByWorkflowId,
|
||||
isDebugModeEnabled,
|
||||
setIsExecuting,
|
||||
setIsDebugging,
|
||||
setDebugContext,
|
||||
|
||||
@@ -252,8 +252,7 @@ const WorkflowContent = React.memo(() => {
|
||||
} = useCollaborativeWorkflow()
|
||||
|
||||
// Execution and debug mode state
|
||||
const { activeBlockIds, pendingBlocks } = useExecutionStore()
|
||||
const { isDebugModeEnabled } = useGeneralStore()
|
||||
const { activeBlockIds, pendingBlocks, isDebugging } = useExecutionStore()
|
||||
const [dragStartParentId, setDragStartParentId] = useState<string | null>(null)
|
||||
|
||||
// Helper function to validate workflow for nested subflows
|
||||
@@ -1273,7 +1272,7 @@ const WorkflowContent = React.memo(() => {
|
||||
const position = block.position
|
||||
|
||||
const isActive = activeBlockIds.has(block.id)
|
||||
const isPending = isDebugModeEnabled && pendingBlocks.includes(block.id)
|
||||
const isPending = isDebugging && pendingBlocks.includes(block.id)
|
||||
|
||||
// Create stable node object - React Flow will handle shallow comparison
|
||||
nodeArray.push({
|
||||
@@ -1302,7 +1301,7 @@ const WorkflowContent = React.memo(() => {
|
||||
blocks,
|
||||
activeBlockIds,
|
||||
pendingBlocks,
|
||||
isDebugModeEnabled,
|
||||
isDebugging,
|
||||
nestedSubflowErrors,
|
||||
getBlockConfig,
|
||||
])
|
||||
|
||||
@@ -57,7 +57,7 @@ export const setupHandlerMocks = () => {
|
||||
* Setup store mocks with configurable options
|
||||
*/
|
||||
export const setupStoreMocks = (options?: {
|
||||
isDebugModeEnabled?: boolean
|
||||
isDebugging?: boolean
|
||||
consoleAddFn?: ReturnType<typeof vi.fn>
|
||||
consoleUpdateFn?: ReturnType<typeof vi.fn>
|
||||
}) => {
|
||||
@@ -66,15 +66,14 @@ export const setupStoreMocks = (options?: {
|
||||
|
||||
vi.doMock('@/stores/settings/general/store', () => ({
|
||||
useGeneralStore: {
|
||||
getState: () => ({
|
||||
isDebugModeEnabled: options?.isDebugModeEnabled ?? false,
|
||||
}),
|
||||
getState: () => ({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.doMock('@/stores/execution/store', () => ({
|
||||
useExecutionStore: {
|
||||
getState: () => ({
|
||||
isDebugging: options?.isDebugging ?? false,
|
||||
setIsExecuting: vi.fn(),
|
||||
reset: vi.fn(),
|
||||
setActiveBlocks: vi.fn(),
|
||||
@@ -925,7 +924,7 @@ export const setupParallelTestMocks = (options?: {
|
||||
* Sets up all standard mocks for executor tests
|
||||
*/
|
||||
export const setupAllMocks = (options?: {
|
||||
isDebugModeEnabled?: boolean
|
||||
isDebugging?: boolean
|
||||
consoleAddFn?: ReturnType<typeof vi.fn>
|
||||
consoleUpdateFn?: ReturnType<typeof vi.fn>
|
||||
}) => {
|
||||
|
||||
@@ -386,11 +386,11 @@ describe('Executor', () => {
|
||||
* Debug mode tests
|
||||
*/
|
||||
describe('debug mode', () => {
|
||||
it('should detect debug mode from settings', async () => {
|
||||
it('should detect debug mode from execution store', async () => {
|
||||
vi.resetModules()
|
||||
vi.clearAllMocks()
|
||||
|
||||
setupAllMocks({ isDebugModeEnabled: true })
|
||||
setupAllMocks({ isDebugging: true })
|
||||
|
||||
const { Executor } = await import('@/executor/index')
|
||||
|
||||
@@ -405,7 +405,7 @@ describe('Executor', () => {
|
||||
vi.resetModules()
|
||||
vi.clearAllMocks()
|
||||
|
||||
setupAllMocks({ isDebugModeEnabled: false })
|
||||
setupAllMocks({ isDebugging: false })
|
||||
|
||||
const { Executor } = await import('@/executor/index')
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ import { VirtualBlockUtils } from '@/executor/utils/virtual-blocks'
|
||||
import type { SerializedBlock, SerializedWorkflow } from '@/serializer/types'
|
||||
import { useExecutionStore } from '@/stores/execution/store'
|
||||
import { useConsoleStore } from '@/stores/panel/console/store'
|
||||
import { useGeneralStore } from '@/stores/settings/general/store'
|
||||
|
||||
const logger = createLogger('Executor')
|
||||
|
||||
@@ -217,7 +216,7 @@ export class Executor {
|
||||
new GenericBlockHandler(),
|
||||
]
|
||||
|
||||
this.isDebugging = useGeneralStore.getState().isDebugModeEnabled
|
||||
this.isDebugging = useExecutionStore.getState().isDebugging
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ export const useGeneralStore = create<GeneralStore>()(
|
||||
isAutoConnectEnabled: true,
|
||||
isAutoPanEnabled: true,
|
||||
isConsoleExpandedByDefault: true,
|
||||
isDebugModeEnabled: false,
|
||||
showFloatingControls: true,
|
||||
showTrainingControls: false,
|
||||
theme: 'system' as const, // Keep for compatibility but not used
|
||||
@@ -101,10 +100,6 @@ export const useGeneralStore = create<GeneralStore>()(
|
||||
)
|
||||
},
|
||||
|
||||
toggleDebugMode: () => {
|
||||
set({ isDebugModeEnabled: !get().isDebugModeEnabled })
|
||||
},
|
||||
|
||||
toggleFloatingControls: async () => {
|
||||
if (get().isFloatingControlsLoading) return
|
||||
const newValue = !get().showFloatingControls
|
||||
|
||||
@@ -2,7 +2,6 @@ export interface General {
|
||||
isAutoConnectEnabled: boolean
|
||||
isAutoPanEnabled: boolean
|
||||
isConsoleExpandedByDefault: boolean
|
||||
isDebugModeEnabled: boolean
|
||||
showFloatingControls: boolean
|
||||
showTrainingControls: boolean
|
||||
theme: 'system' | 'light' | 'dark'
|
||||
@@ -24,7 +23,6 @@ export interface GeneralActions {
|
||||
toggleAutoConnect: () => Promise<void>
|
||||
toggleAutoPan: () => Promise<void>
|
||||
toggleConsoleExpandedByDefault: () => Promise<void>
|
||||
toggleDebugMode: () => void
|
||||
toggleFloatingControls: () => Promise<void>
|
||||
toggleTrainingControls: () => Promise<void>
|
||||
setTheme: (theme: 'system' | 'light' | 'dark') => Promise<void>
|
||||
|
||||
Reference in New Issue
Block a user