Components with data provider issue double fetch request if a filter is set
See original GitHub issueWhen Grid
or IronList
have a ConfigurableFilterDataProvider
and a filter is set before rendering the page, they issue a double request to the server.
For example:
@Route("list")
public class MyList extends Div implements BeforeEnterObserver {
private ConfigurableFilterDataProvider<Foo, String> cfdp;
public MyList(MyDataProvider dp) {
IronList<Foo> list = new IronList<>();
cfdp = dp.withConfigurableFilter();
list.setDataProvider(cfdp);
add(list);
}
@Override
public void beforeEnter(BeforeEnterEvent event) {
String filter = /* calculate from event */
cfdp.setFilter(filter);
}
}
this code will call the MyDataProvider::fetchFromBackend
method twice, while if I comment out the line cfdp.setFilter(filter)
it will fetch only once.
I’m experiencing this with Grid
and IronList
both, so I’m opening this here.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Vaadin Dataprovider: how to avoid "auto-fetch"?
For Case 1: In the callback check if you have filter parameters, return an empty set if not. Using the new V17+ API...
Read more >Lazy, Filtered and Sorted Vaadin Grid using External Data ...
After doing that a call to the method refreshAll() in the DataProvider will trigger the loading of the data with the new filter...
Read more >Advanced topics on caching in Apollo Client
This article describes special cases and considerations when using the Apollo Client cache. Bypassing the cache. Sometimes you shouldn't use the cache for...
Read more >Querying data with code components | Learn Plasmic
Invalidation and mutation accounts for a lot of complexity from more complete data fetching frameworks like swr or react-query. @plasmicapp/query provides a few ......
Read more >React-admin - Using Data Providers - Marmelab
The first step to use a Data Provider is to pass it to the <Admin> component. You can do so by using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@heruan Did you finally find a workaround ? I’m currently facing the exact same issue - I’m using a regular
Grid
like @atistrcsn, , but in my case it’s systematic (I mean not limited to refresh).@atistrcsn I didn’t solve it and I have to verify if it still affects my apps, but I remember it was
IronList
issuing two fetches with different offset/limit values. As soon as I have a chance to double check this I’ll let you know; can you create a repo with a minimal app reproducing this?