Skip to content

Request not being chained for larger limit values #86

@braughtg

Description

@braughtg

Describe the bug
The documentation (here: https://github.com/farmOS/farmOS.js/blob/main/docs/entities.md#limiting-fetch-requests) suggests that when the limit is set to a value larger than the internal drupal page size that 'fetchwill "chain together successive requests until a givenlimit` option is reached." This does not appear to be happening.

To Reproduce
Here is a snippet of sample code that I am using that demonstrates the issue:

  const land = await farm.asset.fetch({
    filter: {
      type: ["asset--land"],
      land_type: ["field", "bed"],
    },
    limit: 30,
  });

farm is a farm instance created as shown in the demo code in the "Quick start" guide.

The database in used has 70 assets that meet the filter criteria, however, the returned land.data array has only 25 assets in it. If limit is set to 30, the result still contains only 25 assets. If the limit is set to 10, then the result correctly contains only 10 assets.

Expected behavior
When limit is provided to fetch it is expected that the result will contain up to a total of limit records matching the filter criteria. When limit is set to Infinity the result should contain all records matching the filter.

Desktop (please complete the following information):

  • Linux, Node.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions