builder icon indicating copy to clipboard operation
builder copied to clipboard

Query in fetchEntries() won't work in SvelteKit

Open Conceptiks opened this issue 1 year ago • 0 comments

Describe the bug A couple of weeks ago, we noticed that when using the SvelteSDK above 1.0.26, we would run into issues with our query passed to fetchEntries.

To Reproduce Steps to reproduce the behavior:

  1. Create a data model in builder.io and assign start and end dates to schedule the data entry for expiry. Make sure it is currently live.
  2. Fetch this data model in SvelteKit using the fetchEntries function. Pass the following query to fetch all currently live entries as well as all entries where no startDate and no endDate have been set:
$or: [
                {
                    $and: [{ startDate: { $lte: Date.now() } }, { endDate: { $gte: Date.now() } }],
                },
                {
                    $and: [{ startDate: { $exists: false } }, { endDate: { $exists: false } }],
                },
            ],
  1. fetchEntries will return an empty array.

Expected behavior fetchEntries should return currently live entries.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I suspect this has something to do with the changes: https://github.com/BuilderIO/builder/issues/3007

Conceptiks avatar Jun 28 '24 12:06 Conceptiks