Skip to content

fix(drag-drop): allow for element in DropListRef to be changed #15091

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
merged 1 commit into from
May 13, 2019

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Feb 5, 2019

It doesn't look like there's a good reason to have the element be readonly, aside from minimizing the coercion logic, since we only use the element in a handful of places and we don't bind any events to it so we don't need any cleanup logic. These changes allow for the element to be swapped out by removing the readonly.

Fixes #15086.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Feb 5, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 5, 2019
@shlomiassaf
Copy link
Contributor

@crisbeto I saw that you removed the readonly allowed direct swap of the element...

I suggest to use the same approach used in DragRef, i.e. withElement(element).

While it doesn't look like any special teardown or init is required for this element, it might be so in the future.

Using withElement will do nothing now but will allow to add setup/teardown logic later without breaking changes

@crisbeto
Copy link
Member Author

crisbeto commented Feb 5, 2019

@shlomiassaf the reason I didn't do it was because the element is accessed by the DragRef as well which means that we'd also need a getter for the element. If we end up needing some teardown logic, we can add it in a non-breaking way with a setter.

@crisbeto crisbeto force-pushed the 15086/drop-list-readonly-element branch from 2394ffc to 3d12a8b Compare February 5, 2019 20:27
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Feb 20, 2019
@jelbourn
Copy link
Member

@crisbeto passes presubmit, needs rebase

It doesn't look like there's a good reason to have the `element` be readonly, aside from minimizing the coercion logic, since we only use the element in a handful of places and we don't bind any events to it so we don't need any cleanup logic. These changes allow for the element to be swapped out by removing the `readonly`.

Fixes angular#15086.
@crisbeto
Copy link
Member Author

Rebased.

@crisbeto crisbeto force-pushed the 15086/drop-list-readonly-element branch from 3d12a8b to 87aa831 Compare February 23, 2019 08:24
@molayodecker
Copy link

@crisbeto can you please fix the error on this PR?

@crisbeto
Copy link
Member Author

The branch-manager check isn't blocking and it's not something I can do anything about.

@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
@jelbourn jelbourn merged commit e630bd6 into angular:master May 13, 2019
RudolfFrederiksen pushed a commit to RudolfFrederiksen/material2 that referenced this pull request Jun 21, 2019
…ar#15091)

It doesn't look like there's a good reason to have the `element` be readonly, aside from minimizing the coercion logic, since we only use the element in a handful of places and we don't bind any events to it so we don't need any cleanup logic. These changes allow for the element to be swapped out by removing the `readonly`.

Fixes angular#15086.
@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 Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[drag-drop] allow changing the element of a DropListRef
6 participants