Skip to content

Commit 1566c6f

Browse files
committed
fix display check for adv fields
1 parent 43fa155 commit 1566c6f

File tree

1 file changed

+13
-3
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor

1 file changed

+13
-3
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/compo
2727
import { getSubBlockStableKey } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/utils'
2828
import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks'
2929
import { getBlock } from '@/blocks/registry'
30+
import type { SubBlockType } from '@/blocks/types'
3031
import { useCollaborativeWorkflow } from '@/hooks/use-collaborative-workflow'
3132
import { usePanelEditorStore } from '@/stores/panel'
3233
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
@@ -101,16 +102,25 @@ export function Editor() {
101102
[blockConfig?.subBlocks]
102103
)
103104
const canonicalModeOverrides = currentBlock?.data?.canonicalModes
105+
const subBlocksForAdvancedCheck = useMemo(() => {
106+
const subBlocks = blockConfig?.subBlocks || []
107+
if (!triggerMode) return subBlocks
108+
return subBlocks.filter(
109+
(subBlock) =>
110+
subBlock.mode === 'trigger' || subBlock.type === ('trigger-config' as SubBlockType)
111+
)
112+
}, [blockConfig?.subBlocks, triggerMode])
113+
104114
const advancedValuesPresent = hasAdvancedValues(
105-
blockConfig?.subBlocks || [],
115+
subBlocksForAdvancedCheck,
106116
blockSubBlockValues,
107117
canonicalIndex
108118
)
109119
const displayAdvancedOptions = advancedMode || advancedValuesPresent
110120

111121
const hasAdvancedOnlyFields = useMemo(
112-
() => hasStandaloneAdvancedFields(blockConfig?.subBlocks || [], canonicalIndex),
113-
[blockConfig?.subBlocks, canonicalIndex]
122+
() => hasStandaloneAdvancedFields(subBlocksForAdvancedCheck, canonicalIndex),
123+
[subBlocksForAdvancedCheck, canonicalIndex]
114124
)
115125

116126
// Get subblock layout using custom hook

0 commit comments

Comments
 (0)