Saulis / iron-data-table

iron-data-table is a Web Component for displaying data as a table or grid. Built on top of iron-list using Polymer.
Apache License 2.0
147 stars 66 forks source link

iron-data-table dataSource change #160

Open BartoszGalek opened 7 years ago

BartoszGalek commented 7 years ago

iron-data-table component has a dataSource property which is a function image

it also contains _pagesLoading image

when the new function is being assigned to dataSource and the page is currently being loaded (slow connection) then observers are being triggered image

_resetData clears selection, cache but does not clear loading pages image

as a consequence the _loadPage is calling the previously set (or in my case unset) dataset function and the page is never being loaded image

to put it in more detail:

The problem happens after the initial dataSource was invoked by the table and the page[0] started loading, but before the dataSource returned data to the callback (slow connection). Then the new dataSource is reassigned but the data are (in the above image check "else if" statement) not requested from the new dataSource, since the page is still registered in _pagesLoading.

We believe that the _pagesLoading should be reset when the table gets a new dataSource, along the lines of resetData method.

Saulis commented 7 years ago

Yeah I see... there's probably a related problem concerning the _cachedPages property which will be appended after the previous data request returns.