Merge branch 'main' into feat/use-handle-connection

This commit is contained in:
peterkogo
2024-10-14 11:41:56 +02:00
8 changed files with 27 additions and 8 deletions
+6
View File
@@ -1,5 +1,11 @@
# @xyflow/svelte
## 0.1.21
### Patch Changes
- [#4718](https://github.com/xyflow/xyflow/pull/4718) [`51f08aac`](https://github.com/xyflow/xyflow/commit/51f08aaca5ddfbaa3259f666005d687d0a83f3db) Thanks [@peterkogo](https://github.com/peterkogo)! - Fixed hook useNodesData unexpectedly returning undefined
## 0.1.20
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@xyflow/svelte",
"version": "0.1.20",
"version": "0.1.21",
"description": "Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.",
"keywords": [
"svelte",
@@ -22,6 +22,7 @@ export function useNodesData(nodeIds: any): any {
const { nodes, nodeLookup } = useStore();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let prevNodesData: any[] = [];
let initialRun = true;
return derived([nodes, nodeLookup], ([, nodeLookup], set) => {
const nextNodesData = [];
@@ -39,9 +40,10 @@ export function useNodesData(nodeIds: any): any {
}
}
if (!shallowNodeData(nextNodesData, prevNodesData)) {
if (!shallowNodeData(nextNodesData, prevNodesData) || initialRun) {
prevNodesData = nextNodesData;
set(isArrayOfIds ? nextNodesData : nextNodesData[0] ?? null);
initialRun = false;
}
});
}