fix: VariableNode size

This commit is contained in:
2026-03-11 13:39:49 +01:00
parent deb1be0d66
commit 1cc6b98973
2 changed files with 8 additions and 3 deletions

View File

@@ -47,9 +47,14 @@ function coerceValue(raw: string, valueType: ValueType): string | number | boole
}
}
function VariableNodeComponent({ id, data, selected }: Props) {
function VariableNodeComponent({ id, data, width, height, selected }: Props) {
const { updateData } = useAbstractNode<VariableNodeData>(id, data ?? {})
const dimensions =
width != null && height != null && width > 0 && height > 0
? { width, height }
: undefined
const valueType: ValueType = data?.valueType ?? 'string'
const value = data?.value ?? DEFAULT_BY_TYPE[valueType]
const displayValue = typeof value === 'string' ? value : String(value)
@@ -79,7 +84,7 @@ function VariableNodeComponent({ id, data, selected }: Props) {
)
return (
<BaseNode className="min-w-56 min-h-[180px]" selected={selected} handles={<OutputHandle id="out" />}>
<BaseNode className="min-w-56 min-h-[180px]" dimensions={dimensions} selected={selected} handles={<OutputHandle id="out" />}>
<BaseNodeHeaderRow icon={<Variable className="size-4" />} title={<NodeHeaderTitle nodeId={id} displayTitle={id} />} />
<BaseNodeContent>

View File

@@ -62,7 +62,7 @@ export function registerBuiltinNodes(): void {
registerNodeType({
id: 'variable',
component: VariableNode,
defaultStyle: { width: 224, height: 180 },
defaultStyle: { width: 224, height: 240 },
defaultData: { value: '', valueType: 'string' },
idPrefix: 'var_',
hasInput: false,