cx 26.7.4 → 26.7.6
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.
- package/build/ui/Cx.d.ts +8 -5
- package/build/ui/Cx.d.ts.map +1 -1
- package/build/ui/Cx.js +114 -97
- package/build/ui/batchUpdates.d.ts +2 -3
- package/build/ui/batchUpdates.d.ts.map +1 -1
- package/build/ui/batchUpdates.js +11 -7
- package/build/widgets/grid/Grid.d.ts.map +1 -1
- package/build/widgets/grid/Grid.js +25 -12
- package/build/widgets/index.d.ts +15 -16
- package/build/widgets/index.d.ts.map +1 -1
- package/build/widgets/index.js +15 -17
- package/dist/manifest.js +746 -749
- package/dist/ui.js +125 -114
- package/dist/widgets.js +3148 -351
- package/package.json +1 -1
- package/src/ui/Cx.spec.tsx +27 -0
- package/src/ui/Cx.tsx +505 -492
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/batchUpdates.ts +12 -9
- package/src/ui/exprHelpers.ts +96 -96
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/form/ColorField.scss +112 -112
- package/src/widgets/form/DateTimeField.scss +111 -111
- package/src/widgets/form/LookupField.maps.scss +26 -26
- package/src/widgets/form/MonthField.scss +113 -113
- package/src/widgets/form/Select.scss +104 -104
- package/src/widgets/form/TextField.scss +66 -66
- package/src/widgets/grid/Grid.tsx +26 -14
- package/src/widgets/index.ts +41 -63
- package/src/widgets/nav/MenuItem.tsx +525 -525
package/package.json
CHANGED
package/src/ui/Cx.spec.tsx
CHANGED
|
@@ -259,6 +259,33 @@ describe("Cx", () => {
|
|
|
259
259
|
assert.equal(notifiedRenderedValue, TARGET, "notify fired before the DOM reflected the final value");
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
+
it("does not fire the notify callback early when an update is already in flight", async () => {
|
|
263
|
+
const TARGET = 50;
|
|
264
|
+
let store = new Store({ data: { n: 0 } });
|
|
265
|
+
const component = await createTestRenderer(store, convergingWidget(TARGET));
|
|
266
|
+
assert.equal(renderedValue(component), TARGET);
|
|
267
|
+
|
|
268
|
+
let notifiedStoreValue = -1;
|
|
269
|
+
let notifiedRenderedValue = -1;
|
|
270
|
+
await act(async () => {
|
|
271
|
+
store.set("n", 0); // puts an update in flight before the notifier below subscribes
|
|
272
|
+
batchUpdatesAndNotify(
|
|
273
|
+
() => {
|
|
274
|
+
store.set("n", 1);
|
|
275
|
+
},
|
|
276
|
+
() => {
|
|
277
|
+
notifiedStoreValue = store.get("n");
|
|
278
|
+
notifiedRenderedValue = renderedValue(component);
|
|
279
|
+
},
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// The write issued inside batchUpdatesAndNotify must be rendered before the notify callback runs,
|
|
284
|
+
// even though it landed while a previous update was still converging.
|
|
285
|
+
assert.equal(notifiedStoreValue, TARGET, "notify saw a pre-fixpoint store value");
|
|
286
|
+
assert.equal(notifiedRenderedValue, TARGET, "notify fired before the DOM reflected the final value");
|
|
287
|
+
});
|
|
288
|
+
|
|
262
289
|
it("converges a deep render burst without tripping React's max-update-depth guard", async () => {
|
|
263
290
|
const TARGET = 200; // far beyond React's ~50 nested-update limit; only survives because of the yield
|
|
264
291
|
let store = new Store({ data: { n: 0 } });
|