@homebound/form-state 2.26.8 → 2.26.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,11 +46,11 @@ function newFragmentField(parentInstance, key) {
|
|
|
46
46
|
value = v;
|
|
47
47
|
_tick.value++;
|
|
48
48
|
},
|
|
49
|
-
set() {
|
|
50
|
-
|
|
49
|
+
set(value) {
|
|
50
|
+
this.value = value;
|
|
51
51
|
},
|
|
52
|
-
adapt() {
|
|
53
|
-
throw new Error("FragmentField
|
|
52
|
+
adapt(value) {
|
|
53
|
+
throw new Error("FragmentField does not support adapt");
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
56
|
return (0, mobx_1.makeAutoObservable)(obj, { value: false });
|
package/dist/formState.test.js
CHANGED
|
@@ -1671,6 +1671,16 @@ describe("formState", () => {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
`);
|
|
1673
1673
|
});
|
|
1674
|
+
it("accepts new values in set", () => {
|
|
1675
|
+
const a = (0, objectField_1.createObjectState)({ title: { type: "value" }, data: { type: "fragment" } }, { title: "b1", data: (0, objectField_1.fragment)({ foo: "1" }) });
|
|
1676
|
+
let numCalcs = 0;
|
|
1677
|
+
(0, mobx_1.autorun)(() => {
|
|
1678
|
+
numCalcs++;
|
|
1679
|
+
noop(a.value);
|
|
1680
|
+
});
|
|
1681
|
+
a.set({ data: (0, objectField_1.fragment)({ foo: "2" }) });
|
|
1682
|
+
expect(numCalcs).toBe(2);
|
|
1683
|
+
});
|
|
1674
1684
|
it("are always considered valid", () => {
|
|
1675
1685
|
const a = (0, objectField_1.createObjectState)({ data: { type: "fragment" } }, { data: (0, objectField_1.fragment)({ foo: "1" }) });
|
|
1676
1686
|
expect(a.valid).toBe(true);
|