Skip to content

feat(core): allow array of ids as updateNodeInternals arg#3007

Merged
moklick merged 4 commits into
xyflow:next-releasefrom
bcakmakoglu:feat/update-node-internals-arr-arg
May 11, 2023
Merged

feat(core): allow array of ids as updateNodeInternals arg#3007
moklick merged 4 commits into
xyflow:next-releasefrom
bcakmakoglu:feat/update-node-internals-arr-arg

Conversation

@bcakmakoglu

Copy link
Copy Markdown
Contributor

What's changed?

  • In addition to a single id, also allow for an array of ids to be passed to updateNodeInternals

@moklick moklick self-assigned this Apr 30, 2023
@moklick

moklick commented May 2, 2023

Copy link
Copy Markdown
Member

thanks @bcakmakoglu! Couldn't we wrap the for each with one requestAnimationFrame here?

@bcakmakoglu

Copy link
Copy Markdown
Contributor Author

Yeah, didn't think of that 😅
I'll update the PR


requestAnimationFrame(() => {
updateIds.forEach((id) => {
updateNodeDimensions([{ id, nodeElement, forceUpdate: true }]);

@moklick moklick May 3, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the nodeElement would always be the same node. You also need to call domNode?.querySelector... multiple times. It's also possible to pass an array with ids and nodeElements to updateNodeDimensions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, that makes sense - I'll change that
Thanks for keeping an eye out, I didn't think too much doing this PR and it shows 🤣

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

querySelector should go in the forEach so that nodeElement matches the actual node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@moklick
moklick changed the base branch from main to next-release May 4, 2023 14:25

requestAnimationFrame(() => {
updateIds.forEach((id) => {
updateNodeDimensions([{ id, nodeElement, forceUpdate: true }]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

querySelector should go in the forEach so that nodeElement matches the actual node.

@bcakmakoglu
bcakmakoglu force-pushed the feat/update-node-internals-arr-arg branch from 6cf8e47 to 80e586f Compare May 10, 2023 10:33
@moklick
moklick merged commit 222ff55 into xyflow:next-release May 11, 2023
@moklick

moklick commented May 11, 2023

Copy link
Copy Markdown
Member

Thanks @bcakmakoglu 🙌

@bcakmakoglu
bcakmakoglu deleted the feat/update-node-internals-arr-arg branch July 17, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants