diff --git a/packages/vue-components/stories/OmegaForm/Union.vue b/packages/vue-components/stories/OmegaForm/Union.vue
index 927381947..cc78dfab8 100644
--- a/packages/vue-components/stories/OmegaForm/Union.vue
+++ b/packages/vue-components/stories/OmegaForm/Union.vue
@@ -5,22 +5,32 @@
label="title"
name="title"
/>
-
+ name="union"
+ >
+
+
+ field.handleChange(
+ v === null ? null : v === 'A' ? { _tag: 'A', a: '' } : { _tag: 'B', b: 0 }
+ )"
+ />
+
+
@@ -45,8 +55,8 @@ class B extends S.TaggedClass()("B", {
}) {}
const schema = S
.Struct({
- title: S.String,
- union: S.Union(A, B)
+ title: S.NonEmptyString,
+ union: S.NullOr(S.Union(A, B))
})
const defaultValues: typeof schema.Encoded = {
@@ -69,7 +79,7 @@ const form = useOmegaForm(schema, {
// sadly doesn't help :S
const values = form.useStore((_) => _.values)
watch(values, (cur, prev) => {
- if (cur.union._tag !== prev.union._tag) {
+ if (cur.union?._tag !== prev.union?._tag) {
console.log("resetting form")
form.reset(cur)
}