Skip to content

Commit 168fdb0

Browse files
committed
feat: change createForm initial value to be a function
1 parent da31186 commit 168fdb0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/primitives/create-form.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export type CreateFormOptions<V extends FormValue> = {
4242
};
4343

4444
export function createForm<V extends FormValue>(
45-
initialValue: V,
45+
initialValue: () => V,
4646
options?: CreateFormOptions<V>,
4747
): FormState<V> {
48-
const [formValue, setFormValue] = createSignal<V>(initialValue);
48+
const [formValue, setFormValue] = createSignal<V>(initialValue());
4949

5050
const [fieldStates, setFieldStates] = createStore<FieldStates>({
5151
dirtyFieldPaths: new ReactiveSet(),

0 commit comments

Comments
 (0)