-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
bug(DragDropModule): Dependency Injection issue with CdkDrag combined with CdkVirtualScroll after upgrade #28744
Comments
…eholder Fixes a regression from angular#28633 where using `cdkDragPlaceholder` or `cdkDragPreview` without a `cdkDrag` would throw. Technically this is a no-op, but it appears that folks started depending on the old behavior so these changes bring it back. Fixes angular#28744.
I've sent a fix at #28750, but I wanted to note that the placeholder in your example does nothing because there's no |
Thanks! That was intentional in the example. The application where I found this is much larger and has the additional elements, but I was trying to get the sample down to the bare minimum that would reproduce it |
…eholder (#28750) Fixes a regression from #28633 where using `cdkDragPlaceholder` or `cdkDragPreview` without a `cdkDrag` would throw. Technically this is a no-op, but it appears that folks started depending on the old behavior so these changes bring it back. Fixes #28744. (cherry picked from commit 9343131)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Is this a regression?
The previous version in which this bug was not present was
17.2.1
Description
I think the changes in PR 28633 (a fix for #28614) may have caused a dependency injection issue when combining virtual scroll and drag and drop. I've setup a very minimal StackBlitz example to show the issue here: https://stackblitz.com/edit/f2xpkk. If you load the example as it is currently with version 17.2.2, you'll see the following stack trace:
vendor.js:47027 ERROR NullInjectorError: R3InjectorError(Standalone[CdkVirtualScrollAppendOnlyExample])[InjectionToken CDK_DRAG_PARENT -> InjectionToken CDK_DRAG_PARENT -> InjectionToken CDK_DRAG_PARENT]:
NullInjectorError: No provider for InjectionToken CDK_DRAG_PARENT!
at NullInjector.get (vendor.js:44290:21)
at R3Injector.get (vendor.js:44741:27)
at R3Injector.get (vendor.js:44741:27)
at R3Injector.get (vendor.js:44741:27)
at ChainedInjector.get (vendor.js:55693:32)
at lookupTokenUsingModuleInjector (vendor.js:46282:31)
at getOrCreateInjectable (vendor.js:46328:10)
at ɵɵdirectiveInject (vendor.js:49755:17)
at ɵɵinject (vendor.js:43467:59)
at inject (vendor.js:43550:10
Reproduction
StackBlitz link: https://stackblitz.com/edit/f2xpkk
Steps to reproduce:
Expected Behavior
No stack trace error and page loads successfully
Actual Behavior
Console errors about dependency injection prevent the component from loading completely
Environment
The text was updated successfully, but these errors were encountered: