Skip to content
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 embedding: allow removing virtual children #6903

Merged
merged 1 commit into from
Nov 12, 2019
Merged

Conversation

pleku
Copy link
Contributor

@pleku pleku commented Nov 11, 2019

Fixes #6822


This change is Reviewable

@ujoni ujoni added the +1.0.0 label Nov 11, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from External Reviews to Changes Requested Nov 11, 2019
Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1.
Reviewable status: 2 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @denis-anisimov)


flow-server/src/main/java/com/vaadin/flow/dom/impl/AbstractNodeStateProvider.java, line 120 at r1 (raw file):

 if (child.isVirtualChild() && node.hasFeature(VirtualChildrenList.class)) {

For me personally it's confusing semantically.
There is no any single method which allows consider a virtual child element as a child (no any way to get it from parent except directly via VirtualChildrenList) so why there is only one method which allows to remove it ?
E.g. there is no getter for virtual child.

And we have a number of places where an element is checked whether it's a real child or not.
In every such place removeChild is not called for virtual child (since it's not a child).

I would may be avoid modifying removeChild API impl at all and use VirtualChildrenList feature directly when removal is needed.

Not blocking since I cannot invent obvious confusion with this method right now.
But I expect such confusion in the future.


flow-server/src/test/java/com/vaadin/flow/router/EventUtilTest.java, line 275 at r1 (raw file):

removingVirtualChildrenIsPossible(

EventUtilTest doesn't seem correct for such test method.

Copy link
Contributor Author

@pleku pleku left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @denis-anisimov)


flow-server/src/main/java/com/vaadin/flow/dom/impl/AbstractNodeStateProvider.java, line 120 at r1 (raw file):

Previously, denis-anisimov (Denis) wrote…
 if (child.isVirtualChild() && node.hasFeature(VirtualChildrenList.class)) {

For me personally it's confusing semantically.
There is no any single method which allows consider a virtual child element as a child (no any way to get it from parent except directly via VirtualChildrenList) so why there is only one method which allows to remove it ?
E.g. there is no getter for virtual child.

And we have a number of places where an element is checked whether it's a real child or not.
In every such place removeChild is not called for virtual child (since it's not a child).

I would may be avoid modifying removeChild API impl at all and use VirtualChildrenList feature directly when removal is needed.

Not blocking since I cannot invent obvious confusion with this method right now.
But I expect such confusion in the future.

I agree that semantically it should be kept separate, not supporting it here.

But since the design decision was already made that adding is visible in Node/Element level, I think it should be 1-1 for the API for removing those.
Hiding it in VirtualChildrenList could make the code just even more cumbersome to understand and maintain.


flow-server/src/test/java/com/vaadin/flow/router/EventUtilTest.java, line 275 at r1 (raw file):

Previously, denis-anisimov (Denis) wrote…
removingVirtualChildrenIsPossible(

EventUtilTest doesn't seem correct for such test method.

Done (somehow I missed ElementTest)

Copy link
Contributor Author

@pleku pleku left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 unresolved discussions, 0 of 1 LGTMs obtained (waiting on @denis-anisimov)


flow-server/src/main/java/com/vaadin/flow/dom/Node.java, line 201 at r2 (raw file):

     * timeout.
     */
    public N removeVirtualChild(Element... children) {

Not sure how this method gets +1.0.0instead of +0.1.0 but for backporting this fix, this cannot be done as is

denis-anisimov
denis-anisimov previously approved these changes Nov 11, 2019
Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r2.
Reviewable status: 1 unresolved discussion, 1 of 1 LGTMs obtained

OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Changes Requested to Reviewer approved Nov 11, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to Changes Requested Nov 11, 2019
@ujoni ujoni added +0.1.0 and removed +1.0.0 labels Nov 11, 2019
@caalador caalador moved this from Changes Requested to External Reviews in OLD Vaadin Flow ongoing work (Vaadin 10+) Nov 12, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from External Reviews to Reviewer approved Nov 12, 2019
Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r3.
Reviewable status: :shipit: complete! all discussions resolved, 1 of 1 LGTMs obtained

@denis-anisimov denis-anisimov merged commit 27927fa into master Nov 12, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Reviewer approved to Done - pending release Nov 12, 2019
@denis-anisimov denis-anisimov deleted the fix/6822 branch November 12, 2019 08:23
@pleku pleku added this to the 2.2.0.alpha4 milestone Nov 12, 2019
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API.
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API.
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API.
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API.
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 12, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
denis-anisimov pushed a commit that referenced this pull request Nov 13, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
pleku added a commit that referenced this pull request Nov 14, 2019
Adopted cherry pick, which doesn't add new public API (only in internal
package).
Can be backported to 2.1 and 2.0

Fixes #6822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
OLD Vaadin Flow ongoing work (Vaadin ...
  
Done - pending release
Development

Successfully merging this pull request may close these issues.

Disconnected exported web components fail to be removed from the UI
3 participants