Firestore and Server Side Pagination - cyclic dependency error

Hello,
I am trying to get Appsmith and firestore to work with server side pagination.

So I have followed the instructions here: Firestore | Appsmith

However the following popup appears ’ A Cyclic dependency error has been encountered on the current page, queries on page load will not run. Please check debugger and Appsmith documentation for more information.’

Appears to fail due to this section in the docs: {{queryName.data[queryName.data.length - 1]}}

Any ideas? Has anyone managed to get Firestore pagination working?

Thanks
Jamie

Can you please share the screenshot of the query you are writing to fetch the data?

Hello
I have the screen shot here on discord.

Thank you
Jamie

You can follow the steps below for a workaround:

  1. Introduce a JsObject into your workflow. The JsObject will only be doing 2 things which are:
    1a. Store the value of the last entry in the table in the Appsmith store
    1b. Run your query each time the store value is updated.

  2. Update your query to use the value stored in the Appsmith store as the cursor for the StartsAfter field.

  3. Update the onPageChange property of your Table widget to run the JsObject created in step 1.

You can check the images below as reference for each step

Step 1

Step 2

Hello, thank you for your feedback.

I have made the changes and it still does not work properly.

Now I do not see the ‘Cyclic Dependency Error’.
I DO see the first page of data results appear in the table - GOOD.
However when I click on the pagination button to go to the next table page. I.E. Page 2 of data results.
The table does not appear and I get the following information:

An error occurred: Cannot call whereEqualTo() after defining a boundary with startAt(), startAfter(), endBefore() or endAt().

Any ideas? thanks
Jamie

In my case, the “Where” field is empty. is this the same for you as well?


If not, how is the where clause organised in your query?

1 Like

Also I see this PR it looks to resolve the issue; fix: Added Firestore pagination paths to self referencing candidates by nidhi-nair · Pull Request #19412 · appsmithorg/appsmith · GitHub

can you tell me when this fix is available on the AppSmith Cloud?

Thank you

Hi, Yes I do have 2 entries in the WHERE. see
FYI the table_filter comes from a select dropdown.

I also have an ‘order by’ in the textarea titled ‘Order By (JSON array of field names to order by)’

I see… Just to be sure the fix works for you, can you try it without the "where " clause and “order by” clause as well. This is just to see if the fix provided earlier works for you.

1 Like

Regarding the PR, the issue has not been totally fixed yet.
I’ll let you know when this has been fixed. Also, you can just keep an eye on the issue for reference on your end as well. Thank you!

1 Like

Ok I’ll do that thanks. I’ll check it again when you let me know. Many thanks