Skip to content

Do not detach child elements if parent element is about to be detached #2420

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

Merged

Conversation

futursolo
Copy link
Member

Description

This pull request aims to minimise the number of DOM API calls when detaching a large number of elements from the DOM tree by only detaching the upper most parent element.

Checklist

Sorry, something went wrong.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.

Unverified

The email in this signature doesn’t match the committer email.

Unverified

The email in this signature doesn’t match the committer email.
# Conflicts:
#	packages/yew-macro/src/hook/body.rs
#	packages/yew-macro/tests/function_component_attr/hook_location-fail.stderr
#	packages/yew-macro/tests/function_component_attr/hook_location-pass.rs
#	packages/yew/src/functional/hooks/mod.rs
#	packages/yew/src/functional/hooks/use_context.rs
#	packages/yew/src/functional/hooks/use_effect.rs
#	packages/yew/src/functional/hooks/use_memo.rs
#	packages/yew/src/functional/hooks/use_reducer.rs
#	packages/yew/src/functional/hooks/use_ref.rs
#	packages/yew/src/functional/hooks/use_state.rs
#	packages/yew/src/functional/mod.rs
#	website/docs/migration-guides/yew/from-0_19_0-to-0_20_0.mdx
@github-actions
Copy link

Visit the preview URL for this PR (updated for commit 461cf38):

https://yew-rs-api--pr2420-no-child-detaching-i-ra93dpum.web.app

(expires Sat, 05 Feb 2022 01:30:43 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@WorldSEnder
Copy link
Member

WorldSEnder commented Jan 29, 2022

Almost the same commit as me in de7df26 (not yet in a PR, so feel free to merge this instead).
I think the only place logic differs from mine is in VSuspense where I think we can get away with pretending the detached_parent always detaches.

@futursolo futursolo mentioned this pull request Jan 29, 2022
3 tasks
Copy link
Member

@ranile ranile left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Just wondering, when is true passed to detach? I see the false being passed almost everywhere.

@ranile ranile requested review from voidpumpkin and siku2 January 30, 2022 10:52
@ranile ranile added A-yew Area: The main yew crate performance labels Jan 30, 2022
@voidpumpkin voidpumpkin merged commit b7b28ba into yewstack:master Jan 30, 2022
@futursolo futursolo deleted the no-child-detaching-if-parent-detached branch March 20, 2022 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants