-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(drag-drop): remove circular dependencies #12554
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
fix(drag-drop): remove circular dependencies #12554
Conversation
78bc342
to
a7276fd
Compare
Note: After this is merged, consider merging #12548 |
* @docs-private | ||
*/ | ||
@Injectable({providedIn: 'root'}) | ||
export class CdkDragDropRegistry implements OnDestroy { | ||
export class CdkDragDropRegistry<I, C extends {id: string}> implements OnDestroy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the things being dragged and dropped are generic, just make the class DragDropRegistry
? The general rule is that things only start with Cdk
if they're a directive with the cdk-
selector prefix, but I interpreted the class name before as "registry for CdkDrag and CdkDrop". Since they're generics now, I don't think we should have the prefix
* Service that keeps track of all the `CdkDrag` and `CdkDrop` instances, and | ||
* manages global event listeners on the `document`. | ||
* Service that keeps track of all the drag item and drop container | ||
* instances, and manages global event listeners on the `document`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a (non-public-facing) comment in this file somewhere that explains why this is genericized instead of using concrete types.
Currently we've got the following circular dependencies in master, after the `CdkDragDropRegistry` got introduced: ``` drop.ts -> drag.ts -> drag-drop-registry.ts -> drop.ts drag.ts -> drag-drop-registry.ts -> drag.ts drop.ts -> drag-drop-registry.ts -> drop.ts ``` These changes rework the registry to avoid importing `CdkDrag` and `CdkDrop`, in order to break the circular references.
a7276fd
to
7667e3e
Compare
I've addressed the feedback @jelbourn. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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. |
Currently we've got the following circular dependencies in master, after the
CdkDragDropRegistry
got introduced:These changes rework the registry to avoid importing
CdkDrag
andCdkDrop
, in order to break the circular references.