fix(react): useNodesInitialized true when nodes measured closes #4202
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
## Patch changes
|
||||
|
||||
- fix batching for `setNodes`, `updateNode`, `updateNodeData` etc.
|
||||
- fix `useNodesInitialized`
|
||||
|
||||
## 12.0.0-next.15
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useStore } from './useStore';
|
||||
import type { ReactFlowState } from '../types';
|
||||
import { nodeHasDimensions } from '@xyflow/system';
|
||||
|
||||
export type UseNodesInitializedOptions = {
|
||||
includeHiddenNodes?: boolean;
|
||||
@@ -10,9 +11,9 @@ const selector = (options: UseNodesInitializedOptions) => (s: ReactFlowState) =>
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const [, node] of s.nodeLookup) {
|
||||
if (options.includeHiddenNodes || !node.hidden) {
|
||||
if (node.internals.handleBounds === undefined) {
|
||||
for (const [, { hidden, internals }] of s.nodeLookup) {
|
||||
if (options.includeHiddenNodes || !hidden) {
|
||||
if (internals.handleBounds === undefined || !nodeHasDimensions(internals.userNode)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user