-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nextLink is always populated if PageSize is set, leading to a never ending loop when fetching data #176
Comments
What's the recommended alternative logic (other than the workaround)? |
Hi, Thanks for the prompt answer. I guess checking the TotalCount is the only way to solve this. But that logic could perhaps be incorporated in the ApplyOptions method, so that if there is a TotalCount, nextLink is not always added. I think the count is done after this in the code today, so the call to will then need to be moved after the count in QueryableExtensions.cs: public static async Task ApplyOptionsAsync<TModel, TData>(this IQueryable query, IMapper mapper, Expression<Func<TModel, bool>> filter, ODataQueryOptions options, QuerySettings querySettings) Br, |
PRs are welcome. I suggest making the fix applicable only if a count is also requested i.e. |
Any news on this? I'm wondering how the |
@jazzmanro No progress but you can use the workaround as shown above. |
Source/destination types
Mapping configuration
Version: 4.0.0
EF Core 7.0.0
Expected behavior
nextLink is set to null when there are no more records to return.
I understand that there will be a need for a count to be included to be able to determine if there is more data to return or not.
Actual behavior
nextLink is always set when PageSize is present, disregarding if there is more data to return or not, leading to a never ending loop when fetching data. The nextLink includes a $skip=, which is correct, but the fetch goes on forever as nextLink is never set to null.
E.g:
"@odata.nextLink": "https://localhost:44334/api/Customer?$count=true&$skip=45500"
The $skip count will go on forever.
Steps to reproduce
Workaround
We implemented a workaround to clear the nextLink if there are no more record to return. This obviously is only possible if we have a TotalCount:
The text was updated successfully, but these errors were encountered: