Issue with Excessive Data Fetching in useInfiniteQuery on staleDuration and refreshInterval
Hello,
I've been exploring your amazing library but am on the verge of giving it up due to an issue that I can't seem to resolve. In the useInfiniteQuery hook, when staleDuration and refreshInterval are set, I'm experiencing an excessive number of data fetch requests. This behavior occurs even when only adjusting the settings slightly from the defaults.
I'm relatively new to Flutter and have tried to understand the root cause by looking into the source code, but haven't had any luck so far.
Flutter Version: 3.10.5 fl_query: ^1.0.0 fl_query_hooks: ^1.0.0
Video:
https://github.com/KRTirtho/fl-query/assets/20950310/75eeec17-c3d1-4eb4-89f2-d8569daa57c0
I used the example directly from the library (packages/fl_query_hooks/example/lib/pages/infinite_query.dart) with almost no modifications. The only changes I made were to speed things up by setting:
staleDuration: Duration(seconds: 5),
refreshInterval: Duration(seconds: 5),
refreshOnMount: false,
refreshOnNetworkStateChange: false,
refreshOnQueryFnChange: false
Additionally, I added an onData callback to log when data is successfully fetched:
onData: (data) {
print("Data fetched successfully");
},
Despite these minor changes, the issue persists. I would greatly appreciate any guidance or suggestions on how to address this excessive fetching behavior.
Thank you for your support and for developing such a useful library.