@tanstack/form-core
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -197,2 +197,5 @@ import { | ||
this.name = opts.name; | ||
if (opts.defaultValue !== void 0) { | ||
this.form.setFieldValue(this.name, opts.defaultValue); | ||
} | ||
this.store = new Store( | ||
@@ -199,0 +202,0 @@ { |
@@ -188,2 +188,5 @@ // src/FieldApi.ts | ||
this.name = opts.name; | ||
if (opts.defaultValue !== void 0) { | ||
this.form.setFieldValue(this.name, opts.defaultValue); | ||
} | ||
this.store = new Store( | ||
@@ -190,0 +193,0 @@ { |
{ | ||
"name": "@tanstack/form-core", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Powerful, type-safe, framework agnostic forms.", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -104,2 +104,6 @@ import { type DeepKeys, type DeepValue, type Updater } from './utils' | ||
if (opts.defaultValue !== undefined) { | ||
this.form.setFieldValue(this.name, opts.defaultValue as never) | ||
} | ||
this.store = new Store<FieldState<TData>>( | ||
@@ -106,0 +110,0 @@ { |
@@ -23,2 +23,18 @@ import { expect } from 'vitest' | ||
it('should use field default value first', () => { | ||
const form = new FormApi({ | ||
defaultValues: { | ||
name: 'test', | ||
}, | ||
}) | ||
const field = new FieldApi({ | ||
form, | ||
defaultValue: 'other', | ||
name: 'name', | ||
}) | ||
expect(field.getValue()).toBe('other') | ||
}) | ||
it('should get default meta', () => { | ||
@@ -25,0 +41,0 @@ const form = new FormApi() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
342847
4459