-
-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Description
When having controlled TextField, it never updates if the value at construction time is undefined. I would expect that the controlled value is allowed to be initially undefined and update the text field content when it becomes a string. Both pairs of text fields in following example should be kept in sync:
https://stackblitz.com/edit/solidjs-templates-yxfy22g2
This regression was introduced in #9ccdc68.
// Disable reactivity to only track controllability on first run
// Our current implementation breaks with undefined (stops tracking controlled value)
const initialValue = local.value;
const [value, setValue] = createControllableSignal({
value: () => (initialValue === undefined ? undefined : local.value ?? ""),
defaultValue: () => local.defaultValue,
onChange: (value) => local.onChange?.(value),
});
It's not clear to me what this commit fixes, therefore not proposing a PR reverting it.
Would this work?
value: () => local.value ?? "",
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels