Repository navigation
Closed
Labels
P2The issue is important to a large percentage of users, with a workaroundarea: coreIssues related to the framework runtimecore: control flowIssues related to the built-in control flow (@if, @for, @switch)core: hydrationstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
Elements are removed from the DOM when they are reordered using the Material DragDropModule.
It seems like this issue only occurs when using the new @for syntax in conjunction with SSR enabled.
So, if I use *ngFor or disable SSR this issue does not occur.
The reordering example is the same as on the official docs: https://material.angular.io/cdk/drag-drop/overview#reordering-lists
There's no error in the console.
drag-drop-bug.mp4
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.0.3
Node: 20.9.0
Package Manager: npm 10.1.0
OS: win32 x64
Angular: 17.0.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1700.3
@angular-devkit/build-angular 17.0.3
@angular-devkit/core 17.0.3
@angular-devkit/schematics 17.0.3
@angular/cdk 17.0.1
@angular/cli 17.0.3
@angular/material 17.0.1
@angular/ssr 17.0.3
@schematics/angular 17.0.3
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
Anything else?
No response
Metadata
Metadata
Assignees
Labels
P2The issue is important to a large percentage of users, with a workaroundarea: coreIssues related to the framework runtimecore: control flowIssues related to the built-in control flow (@if, @for, @switch)core: hydrationstate: has PR
Activity
JeanMeche commentedon Nov 25, 2023
HI !
Could you share a repro on a github repo ?
I did reuse the same example on a
ng new --ssrproject and couldn't reproduce that issue.divvjson commentedon Nov 26, 2023
@JeanMeche Here's a reproduction, https://github.com/davidjohanssson/drag-drop-bug
JeanMeche commentedon Nov 27, 2023
Quick investigation on my side :
When the reconciliation calls
attach()inswap(),shouldAddViewToDom()returnfalsebut the hydrated element doesn't exist anymore as it has been deleted before.AndrewKushnir commentedon Nov 28, 2023
@JeanMeche thanks for the investigation! Could you please try creating a repro without Material components, so that we can use this scenario in tests and perform further investigation? Thank you.
repro for #53163
JeanMeche commentedon Nov 28, 2023
narrowed down repro: https://github.com/JeanMeche/ssr/tree/repro-53163
Let me try to fix it with #53225 :)
repro for #53163
fix(core): Repeater swap after hydration should reinsert element
3 remaining items
fix(core): support swapping hydrated views in `@for` loops
fix(core): support swapping hydrated views in `@for` loops (#53274)
angular-automatic-lock-bot commentedon Jan 1, 2024
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.
fix(core): support swapping hydrated views in `@for` loops (angular#5…
fix(core): support swapping hydrated views in `@for` loops (angular#5…
fix(core): support swapping hydrated views in `@for` loops (angular#5…