Skip to content

Commit addfa4a

Browse files
committed
fix(web): radio group widget
1 parent 9dbf4b1 commit addfa4a

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

apps/api/src/nodes/text/radio-group-node.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class RadioGroupNode extends ExecutableNode {
5656

5757
async execute(context: NodeContext): Promise<NodeExecution> {
5858
try {
59+
console.log(context.inputs);
5960
const options = context.inputs.options as RadioOption[];
6061
const value = context.inputs.value as string;
6162

apps/web/src/components/workflow/widgets/radio-group-widget.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useState } from "react";
2+
13
import { Label } from "@/components/ui/label";
24
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
35
import { cn } from "@/utils/utils";
@@ -23,15 +25,20 @@ export function RadioGroupWidget({
2325
className,
2426
compact = false,
2527
}: RadioGroupWidgetProps) {
28+
const [value, setValue] = useState(config.value);
29+
2630
return (
2731
<div className={cn("space-y-2", className)}>
2832
<RadioGroup
29-
value={config.value}
30-
onValueChange={onChange}
33+
value={value}
34+
onValueChange={(value) => {
35+
setValue(value);
36+
onChange(value);
37+
}}
3138
className={cn("flex flex-col gap-2", compact && "gap-1")}
3239
>
33-
{config.options.map((option) => (
34-
<div key={option.value} className="flex items-center space-x-2">
40+
{config.options.map((option, i) => (
41+
<div key={i} className="flex items-center space-x-2">
3542
<RadioGroupItem value={option.value} id={option.value} />
3643
<Label htmlFor={option.value}>{option.label}</Label>
3744
</div>

0 commit comments

Comments
 (0)