@tscircuit/core 0.0.222 → 0.0.223

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
@@ -90,6 +90,7 @@ declare class Circuit {
90
90
  isRoot: boolean;
91
91
  schematicDisabled: boolean;
92
92
  _hasRenderedAtleastOnce: boolean;
93
+ private _isRendering;
93
94
  constructor();
94
95
  add(componentOrElm: PrimitiveComponent | ReactElement): void;
95
96
  /**
package/dist/index.js CHANGED
@@ -3494,7 +3494,7 @@ var Group = class extends NormalComponent {
3494
3494
  {
3495
3495
  method: "POST",
3496
3496
  body: JSON.stringify({
3497
- input_circuit_json: this.root.db.toArray()
3497
+ input_circuit_json: this.root.getCircuitJson()
3498
3498
  }),
3499
3499
  headers: { "Content-Type": "application/json" }
3500
3500
  }
@@ -3508,7 +3508,7 @@ var Group = class extends NormalComponent {
3508
3508
  {
3509
3509
  method: "POST",
3510
3510
  body: JSON.stringify({
3511
- input_circuit_json: this.root.db.toArray(),
3511
+ input_circuit_json: this.root.getCircuitJson(),
3512
3512
  provider: "freerouting",
3513
3513
  autostart: true
3514
3514
  }),
@@ -5632,6 +5632,7 @@ var Circuit = class {
5632
5632
  isRoot = true;
5633
5633
  schematicDisabled = false;
5634
5634
  _hasRenderedAtleastOnce = false;
5635
+ _isRendering = false;
5635
5636
  constructor() {
5636
5637
  this.children = [];
5637
5638
  this.db = su([]);
@@ -5702,7 +5703,17 @@ var Circuit = class {
5702
5703
  });
5703
5704
  }
5704
5705
  getSoup() {
5705
- if (!this._hasRenderedAtleastOnce) this.render();
5706
+ if (this._isRendering) {
5707
+ return this.db.toArray();
5708
+ }
5709
+ if (!this._hasRenderedAtleastOnce) {
5710
+ this._isRendering = true;
5711
+ try {
5712
+ this.render();
5713
+ } finally {
5714
+ this._isRendering = false;
5715
+ }
5716
+ }
5706
5717
  return this.db.toArray();
5707
5718
  }
5708
5719
  getCircuitJson() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.222",
4
+ "version": "0.0.223",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",