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

Add Component.onChildrenChanged() lifecycle method #1973

Closed
st-pasha opened this issue Sep 30, 2022 · 3 comments · Fixed by #1976
Closed

Add Component.onChildrenChanged() lifecycle method #1973

st-pasha opened this issue Sep 30, 2022 · 3 comments · Fixed by #1976

Comments

@st-pasha
Copy link
Contributor

st-pasha commented Sep 30, 2022

Problem to solve

Currently a component has no way of knowing when it acquires new children or loses existing ones. Which is a shame really, because how it can take good care of its children if it doesn't know what happens to them?

Proposal

Add a new lifecycle method .onChildrenChanged() which would fire whenever new children are added to the component, or existing children removed.

The method could have an argument child, which would indicate the component that caused the lifecycle event. If child.parent == this then the child was just added to the current component; otherwise it was removed.

More information

This would be useful for #1944

@ufrshubham
Copy link
Member

Which is a shame really, because how it can take good care of its children if it doesn't know what happens to them?

Quite irresponsible parent they are 😅

@spydon
Copy link
Member

spydon commented Oct 2, 2022

@rivella50 you have to write something here for me to be able to assign you to the issue seemingly.

@rivella50
Copy link
Contributor

@spydon Done

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

Successfully merging a pull request may close this issue.

4 participants