Skip to content

Commit

Permalink
fix: updateConfig form id update (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoPerard committed Feb 5, 2024
1 parent b4fa797 commit ca7ae75
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/formiz-core/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ export const createStore = <Values extends object = DefaultFormValues>(
actions: {
// FORM
updateConfig: (formConfigRef) => {
const wasReady = get().ready;
set(() => ({
set((state) => ({
formConfigRef,
form: {
...state.form,
id: formConfigRef.current?.id ?? state.form.id,
},
}));
get().actions.reset({ exclude: ["resetKey"] });
},
Expand Down

0 comments on commit ca7ae75

Please sign in to comment.