-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove throws from GraphNode which were unnecessarily interrupting execution #4350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
this._debugInsertChild(node); | ||
// #endif | ||
|
||
this._prepareInsertChild(node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function now does node._parent.removeChild(node);
where it didn't before.
Might that change behaviour?
(Same for insertChild()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what is needed to continue with a valid graph. Better solution than throw.
src/scene/graph-node.js
Outdated
if (node._parent) | ||
node._parent.removeChild(node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the new behavior is that a node is unparented if it already has a parent, perhaps this should be mentioned in the API ref docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this triggers a console error, so it's not expected / new behaviour. It's just a mitigation for the app to reasonably continue instead of crash / create invalid graph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason it can't just be documented behavior and not a mitigation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, I agree it's a more expected behaviour.
Fixes #4228