question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Components with data provider issue double fetch request if a filter is set

See original GitHub issue

When 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:open
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
blignycommented, May 18, 2020

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

0reactions
heruancommented, Jan 8, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found