Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

fix(core): Repeater swap after hydration should reinsert element#53225

Closed
JeanMeche wants to merge 1 commit intoangular:mainangular/angular:mainfrom
JeanMeche:fix/hydration-swapJeanMeche/angular:fix/hydration-swapCopy head branch name to clipboard
Closed

fix(core): Repeater swap after hydration should reinsert element#53225
JeanMeche wants to merge 1 commit intoangular:mainangular/angular:mainfrom
JeanMeche:fix/hydration-swapJeanMeche/angular:fix/hydration-swapCopy head branch name to clipboard

Conversation

@JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Nov 28, 2023

After hydration, a swap during reconciliation removed an item but didn't reattached it if there was a dehydrated node. This commit fixes this.

Fixes #53163

After hydration, a swap remove an item but didn't reattached it if there was a dehydrated node. This commit fixes this.

Fixes angular#53163
@JeanMeche JeanMeche marked this pull request as ready for review November 28, 2023 14:09
@pullapprove pullapprove bot requested a review from alxhub November 28, 2023 14:10
@pkozlowski-opensource pkozlowski-opensource added area: core Issues related to the framework runtime core: hydration labels Nov 28, 2023
@ngbot ngbot bot modified the milestone: Backlog Nov 28, 2023
@AndrewKushnir AndrewKushnir requested review from AndrewKushnir and removed request for alxhub November 28, 2023 18:14
@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Nov 28, 2023
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

@JeanMeche thanks for the PR 馃憤 I think the check should be located closer to the "swap" logic to avoid relying on the DOM state of an element. Instead, we should try to rely on an item state from the @for perspective (i.e. whether it was moved/swapped).

@pkozlowski-opensource
Copy link
Member

I think the check should be located closer to the "swap" logic to avoid relying on the DOM state of an element. Instead, we should try to rely on an item state from the @for perspective (i.e. whether it was moved/swapped).

@AndrewKushnir I would like to better understand the reasoning here. What repeater is doing, in this specific situation, is attaching views to the DOM - either new ones or previously detached while running the algorithm. In this sense we could have logic that always says "attach to the DOM". But I don't think that exact operation (ex. swap / move) should matter here as those are just higher level operations that are building on the detach + attach pair of primitive operations.

I'm all for fixing it in the "right place", just not sure what should be the logic on the repeater side to determine the hydration state. Let's chat!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 31, 2023
@JeanMeche JeanMeche deleted the fix/hydration-swap branch February 29, 2024 13:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime core: hydration target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elements removed from DOM using @for and SSR

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.