@ghchinoy/litflow 0.5.1 → 0.5.2

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": "@ghchinoy/litflow",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "xyflow core integrated with Lit WebComponents",
5
5
  "homepage": "https://litflow.dev",
6
6
  "license": "MIT",
package/src/lit-flow.ts CHANGED
@@ -897,10 +897,18 @@ export class LitFlow extends (SignalWatcher as <T extends Constructor<LitElement
897
897
 
898
898
  // If strategy or direction changed, handles moved. Force re-measurement of all nodes.
899
899
  if (changedProperties.has('layoutStrategy') || changedProperties.has('layoutDirection')) {
900
- this.shadowRoot?.querySelectorAll('.xyflow__node').forEach((el) => {
901
- const id = (el as HTMLElement).dataset.id;
902
- if (id) this._updateNodeDimensions(id, el as HTMLElement);
903
- });
900
+ const nodes = this.shadowRoot?.querySelectorAll('.xyflow__node');
901
+ if (nodes) {
902
+ (async () => {
903
+ const promises = Array.from(nodes).map((el) => {
904
+ const id = (el as HTMLElement).dataset.id;
905
+ return id ? this._updateNodeDimensions(id, el as HTMLElement) : Promise.resolve();
906
+ });
907
+ await Promise.all(promises);
908
+ // After all handles are measured, trigger an update to re-render edges with new handle positions
909
+ this.requestUpdate();
910
+ })();
911
+ }
904
912
  }
905
913
 
906
914
  this.dispatchEvent(new CustomEvent('layout-complete', {