Skip to content
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

Removed children are added again if parent component is moved to other parent #2920

Open
ASGAlex opened this issue Dec 14, 2023 · 4 comments
Labels

Comments

@ASGAlex
Copy link
Contributor

ASGAlex commented Dec 14, 2023

Current bug behavior

Removed childrent are re-added into component whish moved from one parent to another at same update cycle.

Expected behavior

Removed components are removed. They should not be re-added again it this is not requested by user explicitly

Steps to reproduce

  1. Create a component with a child
  2. Add it to one parent
  3. Then in one update cycle remove the child from component and change component's parent
  4. in next update cycle you will see that removed child is added to the component again due to _reAddChildren call

More information

_reAddChildren chould have a list of exceptions with all removed components inside to avoid adding it again

@ASGAlex ASGAlex added the bug label Dec 14, 2023
@spydon
Copy link
Member

spydon commented Dec 15, 2023

Can you post a full MRE? This sounds very unlikely that it wouldn't have been reported before. Is it happening in some edge case?

ASGAlex added a commit to ASGAlex/flame that referenced this issue Dec 16, 2023
@ASGAlex
Copy link
Contributor Author

ASGAlex commented Dec 16, 2023

@spydon take a look on the commit above. This simple test should not fail. But it fails.

The reason is simple: while moving components from one parent to another it's children are not re-added immediately, instead everything is passed to the queue. So adding operation is performed just after removing operation, the queu just does not care about it.

@spydon
Copy link
Member

spydon commented Dec 16, 2023

Ah yes, so it's in the same tick, that was the info I was missing :)

@ASGAlex
Copy link
Contributor Author

ASGAlex commented Jan 20, 2024

I did not research it deeply, but it might be also triggered by multiple tree modifications in same tick

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants