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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "26.7.4",
3
+ "version": "26.7.6",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "exports": {
6
6
  "./data": {
@@ -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 } });