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

Object3D: Fix clear() emitting removed events too early. #26625

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

ycw
Copy link
Contributor

@ycw ycw commented Aug 21, 2023

The issue: demo: state not yet updated in removed handler

The cause: clear() emits removed event before removing children from parent

A solution: clear() emits removed event immediately after a child gets removed from parent

i.e. remove children one by one (instead of children.length=0) should do the trick

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
646.4 kB (160.4 kB) 646.3 kB (160.3 kB) -97 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
439.3 kB (106.4 kB) 439.2 kB (106.4 kB) -97 B

@Mugen87 Mugen87 added this to the r156 milestone Aug 22, 2023
@Mugen87 Mugen87 changed the title Fix: Object3D .clear() emits removed too early Object3D: Fix clear() emitting removed events too early. Aug 22, 2023
@Mugen87 Mugen87 merged commit ba16e0d into mrdoob:dev Aug 23, 2023
@ycw ycw deleted the object3d_clear branch September 14, 2023 19:01
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