Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Fixes #516 and #515 #517

Merged
merged 5 commits into from
Feb 26, 2019
Merged

Fixes #516 and #515 #517

merged 5 commits into from
Feb 26, 2019

Conversation

appreciated
Copy link

@appreciated appreciated commented Feb 11, 2019

This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Feb 11, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@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.

Thanks for the contribution @appreciated, I would have done the same changes myself but didn't yet get to it.

Also I had no idea (nor did @tomivirkki ) that this might get executed when the underlying iron list doens't have anything in the DOM.

@appreciated
Copy link
Author

appreciated commented Feb 11, 2019

I would have done the same changes myself but didn't yet get to it.

@pleku I'm sure you would have 🙂.

Also I had no idea (nor did @tomivirkki ) that this might get executed when the underlying iron list doens't have anything in the DOM.

Maybe the causes some additional resize events which then cause the grid to update itself before it is initialized 🤔? Just a guess.

@ujoni ujoni added this to the 3.0.1 milestone Feb 13, 2019
Copy link

@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.

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

a discussion (no related file):
Is it possible to create an IT test for this ?


Copy link

@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 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @denis-anisimov)

@appreciated
Copy link
Author

appreciated commented Feb 18, 2019

Is it possible to create an IT test for this ?

@denis-anisimov not sure since this only throws a client side exception. Note that I have pretty much no experience with Testbench.

Copy link

@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.

Do you have a scenario when a client side exception is thrown ?

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @denis-anisimov)

@heruan
Copy link
Member

heruan commented Feb 18, 2019

@denis-anisimov There is an example project in #515 which should replicate the issue, is that what you need?

@denis-anisimov
Copy link

@denis-anisimov There is an example project in #515 which should replicate the issue, is that what you need?

OK, so it means that it's possible to make IT test for the fix.

@ZheSun88 ZheSun88 added the waiting for author PR has been reviewed, but needs further changes from the author label Feb 19, 2019
@heruan
Copy link
Member

heruan commented Feb 19, 2019

@appreciated and @jflamy do you think you can add an IT to get this merged? You already have a sample project which replicates, I have no TestBench experience but I guess it should be pretty straighforward with the code you already have.

@heruan
Copy link
Member

heruan commented Feb 19, 2019

Worth noting this might (just a guess, not tested) be fixed in the Web Component, initializing _physicalItems as an empty array instead of null at vaadin/vaadin-grid/src/iron-list.html#L113.

@ujoni ujoni removed this from the 3.0.1 milestone Feb 19, 2019
@appreciated
Copy link
Author

Any requirements for the integration-test? Can I find some coding guidelines for that anywhere?

@denis-anisimov
Copy link

No any specific requirements.
Let's see the result in review.

Just use existing code as an example.
E.g. https://github.com/vaadin/vaadin-grid-flow/blob/master/vaadin-grid-flow-integration-tests/src/main/java/com/vaadin/flow/component/grid/it/DetailsGridPage.java is a page which contains a usecase (UI control elements to reproduce the issue).
And https://github.com/vaadin/vaadin-grid-flow/blob/master/vaadin-grid-flow-integration-tests/src/test/java/com/vaadin/flow/component/grid/it/DetailsGridIT.java is an IT test code.

@heruan
Copy link
Member

heruan commented Feb 20, 2019

@appreciated, did you find out what is triggering the error? I'm not using any addon (just Grid) and I'm experiencing this in my app, but I cannot replicate in a simple project or IT test.

@heruan
Copy link
Member

heruan commented Feb 25, 2019

I still can't figure out what is causing this. Any chance the team will fix this for V13, if the author doesn't?

@appreciated
Copy link
Author

appreciated commented Feb 25, 2019

I'm onto something. This issue only occurs if the grid is being wrapped inside a PolymerTemplate. I'm currently trying to put a mini-minimal example together.

@appreciated
Copy link
Author

appreciated commented Feb 25, 2019

This is so wierd 😒.

An example project with the following code can be found here

Wrapping a non empty Grid:

GridTest

public class GridTest extends Grid<GridTest.Person> {

    List<Person> people = new ArrayList<>();

    public GridTest() {
        Random random = new Random();
        for (int i = 0; i < 300; i++) {
            people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
        }
        setItems(people);
        addColumn(person -> person.name);
        setSizeFull();
    }

    public class Person {
        private final String name;
        private final int id;
        private final int year;

        public Person(String name, int year, int id) {
            this.name = name;
            this.year = year;
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public int getBirthYear() {
            return year;
        }

        public int getID() {
            return id;
        }
    }
}

in a Template as follows

MyTemplate

@Tag("a-template")
@HtmlImport("frontend://src/polymer-template.html")
public class MyTemplate extends PolymerTemplate<TemplateModel> implements HasComponents {
    @Id("test")
    Div div;
}

polymer-template.html

<link rel="import" href="../bower_components/polymer/polymer-element.html">

<dom-module id="a-template">
    <template>
        <style>
            #test {
                width: 100%;
                height: 100%;
            }
        </style>
        <div id="test">
        <slot></slot>
        </div>
    </template>
    <script>
        class ATemplate extends Polymer.Element {
            static get is() {
                return 'a-template'
            }
        }
        customElements.define(ATemplate.is, ATemplate);
    </script>
</dom-module>

Causes the issue.

But there is even more:

  • If a PolymerTemple without a @Id binding is used this issue will not occur
  • The issue only occurs in Chrome but not in Firefox

@appreciated
Copy link
Author

@denis-anisimov I just found that I'm required to have a pro subscription to write Integration tests which I currently don't have. So I guess this need to be done by someone that has one 😓.

@heruan
Copy link
Member

heruan commented Feb 25, 2019

Thank you @appreciated for the thorough analysis! In my case the grid is in the lightdom of a component which is a PolymerTemplate, so maybe you're right.

I really hope the team can fix this for the upcoming platform release!

@heruan
Copy link
Member

heruan commented Feb 25, 2019

Worth noting that another issue in ComboBox connector happens under similar conditions: vaadin/vaadin-combo-box-flow#219

@denis-anisimov
Copy link

I cannot merge it without a test.
It's too hard to use your branch to write the test and the fix is trivial.
So it's better to close this PR and make a new one.

@denis-anisimov
Copy link

It's decided to merge this PR.
I will create another ticket for a test.

Copy link

@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 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @appreciated and @denis-anisimov)

Copy link

@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:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @appreciated and @denis-anisimov)

Copy link

@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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @appreciated)

@denis-anisimov denis-anisimov merged commit f5e67ea into vaadin:master Feb 26, 2019
denis-anisimov pushed a commit that referenced this pull request Feb 26, 2019
denis-anisimov pushed a commit that referenced this pull request Feb 26, 2019
* Update vaadin-grid-flow-selection-column width (#520)

* Fixing IllegalStateException after new item added and dataprovider re…
(#533)

* Fix GridTRElement select for single select grid (#537)

Cherry picked from vaadin/vaadin-components-testbench#70
Also added test using TBElement api

* Do not deselect if row was not selected

Cherry picked from vaadin/vaadin-components-testbench#72

* flushing _debounceIncreasePool if it is available

* add integration test for focusing editor component

* Refresh on client-side events only (#548)

* fix #516 and fix #515 (#517)
denis-anisimov pushed a commit that referenced this pull request Mar 4, 2019
denis-anisimov pushed a commit that referenced this pull request Mar 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting for author PR has been reviewed, but needs further changes from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants