Differences between Xano Request and Fetching Collection

What is the difference between the two options? I’ve added a loader element and it’s display is bound to whether the collection is fetching or not.

However, I am currently using the xano requests and I don’t see the loader appear but I can’t tell if it is because there isn’t that much of a delay due to me not having many items in my database right now or because I should be using fetch collections instead?

The FETCH COLLECTION is a Xano GET request in the background. You can see in your Collection configuration that you selected a GET endpoint. BUT, I don’t think that a simple Xano GET request alone would auto-update your collection. You would usually use a Xano GET Request to get temp data (other than your collection data), or save it to a variable.

If your collection is set to update automatically, my understanding is that the collection will fetch as soon as you request data from it (maybe with some sort of debounce).

So, if you want to use the is_fetching value, you would probably need to use the FETCH COLLECTION action instead of XANO REQUEST. I didn’t test it out though.

It should be fairly easy for you to swap the Xano Request for a Fetch collection and test. If you still don’t see the loader, it’s probably because it is happening to quickly.

If you really want to validate that it works, you can try to capture the information by adding a check right after the fetch collection, where you would set a variable based on the is_fetching value. This action will be quicker than the UI and might register it even though the loader itself doesn’t have enough time to.

1 Like

I bound the loader to the workflow instead and I can see that it is appearing now, however, what you mention does raise a couple of questions for me. Would there be a functional difference between the two options for the user? For example, in the use case of a search of products would it be preferrable to use one method over the other?

There’s one bit of information I don’t have and it is whether WeWeb will auto-detect your Xano GET request as the same one configured on the collection, and update the collection automatically.

If it doesn’t, then you might get different results out of the Xano GET call and a collection query (if the collection isn’t set to auto-update and isn’t fetched right before the query, from a component let’s say).

In any case, if you have configured a collection in WeWeb for a given data-set, I think you should poll the collection directly instead of using a Xano Request for that same data-set, and either:

  • Configure the collection to auto-update
  • Fetch the collection before polling it (if you have components bound to that collection on your page, create a workflow on page load and add a fetch collection action)

There might be situations where one would still use a Xano Request for the same GET request, maybe for performance reasons? But even then… I’m not sure I can think of any reason to use a Xano Request if you have that exact same collection configured.

Hope this helps :slight_smile:

1 Like

Thank you, as you mentioned it’s probably just best practice to do it through the fetch collection anyways.