From 3f840bbf1007e8b788b1ddde8783f630ee36e4ce Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Thu, 16 Jan 2025 15:51:26 -0800 Subject: [PATCH] Completed subblock state for all except table and code --- .../sub-block/components/dropdown.tsx | 8 +++++++- .../sub-block/components/long-input.tsx | 6 +++--- .../sub-block/components/short-input.tsx | 5 +++-- .../sub-block/components/slider-input.tsx | 15 ++++++++------- .../workflow-block/sub-block/sub-block.tsx | 8 ++++---- blocks/configs/agent.ts | 5 +++++ blocks/configs/api.ts | 4 ++++ blocks/configs/conditional.ts | 2 ++ blocks/types/block.ts | 2 +- 9 files changed, 37 insertions(+), 18 deletions(-) diff --git a/app/w/components/workflow-block/sub-block/components/dropdown.tsx b/app/w/components/workflow-block/sub-block/components/dropdown.tsx index caf4b10200..8203251fa0 100644 --- a/app/w/components/workflow-block/sub-block/components/dropdown.tsx +++ b/app/w/components/workflow-block/sub-block/components/dropdown.tsx @@ -5,6 +5,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' +import { useSubBlockValue } from '../hooks/use-sub-block-value' interface DropdownProps { options: string[] @@ -19,8 +20,13 @@ export function Dropdown({ blockId, subBlockId, }: DropdownProps) { + const [value, setValue] = useSubBlockValue(blockId, subBlockId) + return ( - setValue(value)} + > diff --git a/app/w/components/workflow-block/sub-block/components/long-input.tsx b/app/w/components/workflow-block/sub-block/components/long-input.tsx index 4afc3e0dbd..d42d4512ca 100644 --- a/app/w/components/workflow-block/sub-block/components/long-input.tsx +++ b/app/w/components/workflow-block/sub-block/components/long-input.tsx @@ -1,5 +1,5 @@ import { Textarea } from '@/components/ui/textarea' -import { useState } from 'react' +import { useSubBlockValue } from '../hooks/use-sub-block-value' interface LongInputProps { placeholder?: string @@ -12,14 +12,14 @@ export function LongInput({ blockId, subBlockId, }: LongInputProps) { - const [value, setValue] = useState('') + const [value, setValue] = useSubBlockValue(blockId, subBlockId) return (