Skip to content

Commit 8ca96c2

Browse files
committed
address comments
1 parent 54e1852 commit 8ca96c2

13 files changed

Lines changed: 224 additions & 191 deletions

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-folder-expand.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { useCallback } from 'react'
22
import { useFolderStore } from '@/stores/folders/store'
33

4+
const toggleFolderExpanded = useFolderStore.getState().toggleExpanded
5+
const setFolderExpanded = useFolderStore.getState().setExpanded
6+
47
interface UseFolderExpandProps {
58
folderId: string
69
}
@@ -14,23 +17,21 @@ interface UseFolderExpandProps {
1417
*/
1518
export function useFolderExpand({ folderId }: UseFolderExpandProps) {
1619
const expandedFolders = useFolderStore((state) => state.expandedFolders)
17-
const toggleExpanded = useFolderStore((state) => state.toggleExpanded)
18-
const setExpanded = useFolderStore((state) => state.setExpanded)
1920
const isExpanded = expandedFolders.has(folderId)
2021

2122
/**
2223
* Toggle folder expansion state
2324
*/
2425
const handleToggleExpanded = useCallback(() => {
25-
toggleExpanded(folderId)
26-
}, [folderId, toggleExpanded])
26+
toggleFolderExpanded(folderId)
27+
}, [folderId])
2728

2829
/**
2930
* Expand the folder (useful when creating items inside)
3031
*/
3132
const expandFolder = useCallback(() => {
32-
setExpanded(folderId, true)
33-
}, [folderId, setExpanded])
33+
setFolderExpanded(folderId, true)
34+
}, [folderId])
3435

3536
/**
3637
* Handle keyboard navigation (Enter/Space)

apps/sim/hooks/use-reactive-conditions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CanonicalModeOverrides } from '@/lib/workflows/subblocks/visibilit
33
import { buildCanonicalIndex, resolveDependencyValue } from '@/lib/workflows/subblocks/visibility'
44
import type { SubBlockConfig } from '@/blocks/types'
55
import { useWorkspaceCredential } from '@/hooks/queries/credentials'
6-
import { useSubBlockStore } from '@/stores/workflows/subblock/store'
6+
import { EMPTY_BLOCK_SUBBLOCK_VALUES, useSubBlockStore } from '@/stores/workflows/subblock/store'
77

88
/**
99
* Evaluates reactive conditions for subblocks. Always calls the same hooks
@@ -27,7 +27,8 @@ export function useReactiveConditions(
2727
useCallback(
2828
(state) => {
2929
if (!reactiveCond || !activeWorkflowId) return ''
30-
const blockValues = state.workflowValues[activeWorkflowId]?.[blockId] ?? {}
30+
const blockValues =
31+
state.workflowValues[activeWorkflowId]?.[blockId] ?? EMPTY_BLOCK_SUBBLOCK_VALUES
3132
for (const field of reactiveCond.watchFields) {
3233
const val = resolveDependencyValue(
3334
field,

0 commit comments

Comments
 (0)