@ai-matrx/content-ir-react 0.12.7 → 0.13.0

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/dist/index.js CHANGED
@@ -178,6 +178,7 @@ var ComponentResolver = class {
178
178
  * key wins: rows arrive is_default-first / sort_order-asc from the source.
179
179
  */
180
180
  ingestDbRows(rows) {
181
+ const wasSettled = this.hasSettled();
181
182
  const changedKinds = /* @__PURE__ */ new Set();
182
183
  for (const row of rows) {
183
184
  const key = keyOf(row.kind, row.platform, row.role);
@@ -190,6 +191,27 @@ var ComponentResolver = class {
190
191
  for (const kind of changedKinds) this.bumpKind(kind);
191
192
  this.notifyChanged();
192
193
  }
194
+ if (!wasSettled && this.hasSettled()) this.notifySettled();
195
+ }
196
+ /**
197
+ * Mark the tier settled. THE COLD-VERDICT RULE held every block whose kind
198
+ * the tier could not answer; settling changes that verdict for ALL of them,
199
+ * so the flip bumps the epoch and calls every per-kind listener (as a
200
+ * wholesale replace does). Before 0.13.0 a settle notified only kinds that
201
+ * gained rows, and a waiting block for any other kind kept its pre-settle
202
+ * rendering until something unrelated re-rendered it.
203
+ */
204
+ markSettled() {
205
+ const wasSettled = this.hasSettled();
206
+ this.settled = true;
207
+ if (!wasSettled) this.notifySettled();
208
+ }
209
+ notifySettled() {
210
+ this.epoch += 1;
211
+ for (const set of this.kindListeners.values()) {
212
+ for (const listener of set) listener();
213
+ }
214
+ this.notifyChanged();
193
215
  }
194
216
  /**
195
217
  * Refresh landing point: REPLACE the db tier wholesale (same
@@ -286,6 +308,7 @@ var ComponentResolver = class {
286
308
  return;
287
309
  }
288
310
  this.coldInFlight.add(flightKey);
311
+ const versionBefore = this.kindVersions.get(kind) ?? 0;
289
312
  void (async () => {
290
313
  try {
291
314
  this.ingestColdRows(await loadForKind(kind, platform));
@@ -301,6 +324,9 @@ var ComponentResolver = class {
301
324
  });
302
325
  } finally {
303
326
  this.coldInFlight.delete(flightKey);
327
+ if ((this.kindVersions.get(kind) ?? 0) === versionBefore) {
328
+ this.bumpKind(kind);
329
+ }
304
330
  }
305
331
  })();
306
332
  }
@@ -342,7 +368,7 @@ var ComponentResolver = class {
342
368
  if (!this.warmPromise) {
343
369
  this.warmPromise = loadAll().then((rows) => {
344
370
  this.ingestDbRows(rows);
345
- this.settled = true;
371
+ this.markSettled();
346
372
  this.warmFailures = 0;
347
373
  if (this.warmRetryTimer) {
348
374
  clearTimeout(this.warmRetryTimer);
@@ -360,7 +386,7 @@ var ComponentResolver = class {
360
386
  this.warmFailures += 1;
361
387
  const delay = WARM_RETRY_DELAYS_MS[this.warmFailures - 1] ?? null;
362
388
  if (delay === null) {
363
- this.settled = true;
389
+ this.markSettled();
364
390
  } else if (!this.warmRetryTimer) {
365
391
  this.warmRetryTimer = setTimeout(() => {
366
392
  this.warmRetryTimer = null;