@tscircuit/core 0.0.1294 → 0.0.1295

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.d.ts CHANGED
@@ -230,6 +230,7 @@ interface DebugLogOutputEvent {
230
230
  interface IIsolatedCircuit {
231
231
  emit(event: RootCircuitEventName, ...args: any[]): void;
232
232
  on(event: RootCircuitEventName, listener: (...args: any[]) => void): void;
233
+ isDoneRendering(): boolean;
233
234
  _hasIncompleteAsyncEffectsForPhase(phase: RenderPhase): boolean;
234
235
  }
235
236
 
@@ -387,6 +388,7 @@ declare class IsolatedCircuit {
387
388
  _hasRenderedAtleastOnce: boolean;
388
389
  private _asyncEffectIdsByPhase;
389
390
  private _asyncEffectPhaseById;
391
+ private _hasUnrenderedUpdatesFromAsyncEffects;
390
392
  private _runningAsyncEffectsById;
391
393
  constructor({ platform, projectUrl, cachedSubcircuits, pendingSubcircuitRenders, }?: {
392
394
  platform?: PlatformConfig;
@@ -403,6 +405,7 @@ declare class IsolatedCircuit {
403
405
  _guessRootComponent(): void;
404
406
  render(): void;
405
407
  renderUntilSettled(): Promise<void>;
408
+ isDoneRendering(): boolean;
406
409
  _hasIncompleteAsyncEffects(): boolean;
407
410
  _hasIncompleteAsyncEffectsForPhase(phase: RenderPhase): boolean;
408
411
  getRunningAsyncEffects(): Array<{
package/dist/index.js CHANGED
@@ -22348,7 +22348,7 @@ import { identity as identity5 } from "transformation-matrix";
22348
22348
  var package_default = {
22349
22349
  name: "@tscircuit/core",
22350
22350
  type: "module",
22351
- version: "0.0.1293",
22351
+ version: "0.0.1294",
22352
22352
  types: "dist/index.d.ts",
22353
22353
  main: "dist/index.js",
22354
22354
  module: "dist/index.js",
@@ -22524,6 +22524,7 @@ var IsolatedCircuit = class {
22524
22524
  _hasRenderedAtleastOnce = false;
22525
22525
  _asyncEffectIdsByPhase = /* @__PURE__ */ new Map();
22526
22526
  _asyncEffectPhaseById = /* @__PURE__ */ new Map();
22527
+ _hasUnrenderedUpdatesFromAsyncEffects = false;
22527
22528
  _runningAsyncEffectsById = /* @__PURE__ */ new Map();
22528
22529
  constructor({
22529
22530
  platform,
@@ -22610,6 +22611,7 @@ var IsolatedCircuit = class {
22610
22611
  if (!firstChild) throw new Error("IsolatedCircuit has no root component");
22611
22612
  firstChild.parent = this;
22612
22613
  firstChild.runRenderCycle();
22614
+ this._hasUnrenderedUpdatesFromAsyncEffects = false;
22613
22615
  this._hasRenderedAtleastOnce = true;
22614
22616
  }
22615
22617
  async renderUntilSettled() {
@@ -22621,14 +22623,18 @@ var IsolatedCircuit = class {
22621
22623
  });
22622
22624
  }
22623
22625
  this.render();
22624
- while (this._hasIncompleteAsyncEffects()) {
22626
+ while (!this.isDoneRendering()) {
22625
22627
  await new Promise((resolve) => setTimeout(resolve, 100));
22626
22628
  this.render();
22627
22629
  }
22628
22630
  this.emit("renderComplete");
22629
22631
  }
22632
+ isDoneRendering() {
22633
+ return this._hasRenderedAtleastOnce && !this._hasIncompleteAsyncEffects();
22634
+ }
22630
22635
  _hasIncompleteAsyncEffects() {
22631
22636
  if (this._asyncEffectPhaseById.size > 0) return true;
22637
+ if (this._hasUnrenderedUpdatesFromAsyncEffects) return true;
22632
22638
  return this.children.some((child) => child._hasIncompleteAsyncEffects());
22633
22639
  }
22634
22640
  _hasIncompleteAsyncEffectsForPhase(phase) {
@@ -22757,6 +22763,7 @@ var IsolatedCircuit = class {
22757
22763
  }
22758
22764
  this._asyncEffectPhaseById.delete(asyncEffectId);
22759
22765
  this._runningAsyncEffectsById.delete(asyncEffectId);
22766
+ this._hasUnrenderedUpdatesFromAsyncEffects = true;
22760
22767
  }
22761
22768
  };
22762
22769
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1294",
4
+ "version": "0.0.1295",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",