Skip to content

Commit f791d66

Browse files
committed
fix: align async selector fetch signatures
1 parent c0cd00a commit f791d66

File tree

3 files changed

+15
-3
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components
    • blocks

3 files changed

+15
-3
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ interface ComboBoxProps {
5959
/** Configuration for the sub-block */
6060
config: SubBlockConfig
6161
/** Async function to fetch options dynamically */
62-
fetchOptions?: (blockId: string) => Promise<Array<{ label: string; id: string }>>
62+
fetchOptions?: (
63+
blockId: string,
64+
subBlockId: string
65+
) => Promise<Array<{ label: string; id: string }>>
6366
/** Async function to fetch a single option's label by ID (for hydration) */
6467
fetchOptionById?: (
6568
blockId: string,
69+
subBlockId: string,
6670
optionId: string
6771
) => Promise<{ label: string; id: string } | null>
6872
/** Field dependencies that trigger option refetch when changed */

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@ interface DropdownProps {
5353
/** Enable multi-select mode */
5454
multiSelect?: boolean
5555
/** Async function to fetch options dynamically */
56-
fetchOptions?: (blockId: string) => Promise<Array<{ label: string; id: string }>>
56+
fetchOptions?: (
57+
blockId: string,
58+
subBlockId: string
59+
) => Promise<Array<{ label: string; id: string }>>
5760
/** Async function to fetch a single option's label by ID (for hydration) */
5861
fetchOptionById?: (
5962
blockId: string,
63+
subBlockId: string,
6064
optionId: string
6165
) => Promise<{ label: string; id: string } | null>
6266
/** Field dependencies that trigger option refetch when changed */

apps/sim/blocks/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,15 @@ export interface SubBlockConfig {
421421
triggerId?: string
422422
// Dropdown/Combobox: Function to fetch options dynamically
423423
// Works with both 'dropdown' (select-only) and 'combobox' (editable with expression support)
424-
fetchOptions?: (blockId: string) => Promise<Array<{ label: string; id: string }>>
424+
fetchOptions?: (
425+
blockId: string,
426+
subBlockId: string
427+
) => Promise<Array<{ label: string; id: string }>>
425428
// Dropdown/Combobox: Function to fetch a single option's label by ID (for hydration)
426429
// Called when component mounts with a stored value to display the correct label before options load
427430
fetchOptionById?: (
428431
blockId: string,
432+
subBlockId: string,
429433
optionId: string
430434
) => Promise<{ label: string; id: string } | null>
431435
}

0 commit comments

Comments
 (0)