We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 40b3354 commit 02e6dffCopy full SHA for 02e6dff
2 files changed
packages/bonito-core/src/form/__tests__/form.spec.ts
@@ -284,6 +284,18 @@ describe("Form tests", () => {
284
},
285
}
286
);
287
+
288
+ // form.setValues() should set the values of the subForm
289
+ form.setValues({
290
+ ...form.values,
291
+ answers: {
292
+ color: "yellow",
293
+ },
294
+ });
295
296
+ expect(subForm.values).toEqual({
297
298
299
});
300
301
test("Validation", async () => {
packages/bonito-core/src/form/internal/form-impl.ts
@@ -256,6 +256,11 @@ export class FormImpl<V extends FormValues> implements Form<V> {
256
return;
257
258
this._values = values;
259
+ for (const e of this.allEntries()) {
260
+ if (e instanceof SubForm) {
261
+ e.setValues(values[e.name]);
262
+ }
263
264
this._formValuesChanged(values, oldValues);
265
266
0 commit comments