How to set loader on fetching specific record by Xano endpoint (not collection)

Let me explain my question.

For “LIST of products” page i use Fetch collection → co its easy to set variable of displaying loader on parameter “isFetching” and it pefeclty works! Awesome.

When user clicks on list item I have next steps:

  1. populate Query Var “product_id”
  2. navigate to Product Details Page
  3. in prod. details page I have a workflow on load which Fetches product with id=product_id query var
  4. I populate var “ProductData” as object from Fetching one product (separate endpoint)
  5. in fields of specific product I display data from the Var

My problem is that for specific product I cannot find parameter “isFetching” in editor on any step… Like i have it for Collections.

SO my data is appears after some time and is looks confusing.

How do I find is Fetching for specific product??

How it looks without loader:

1 Like

There is not going to be isFetching for that.

You need to create a separate variable that you bind the display of your loader to.

Here is what I do:

Create a variable called “form” and set it to type object with null keys of “name”, “action”, “status”, “message”

Then, in the first step of your workflow,

Set:
Form.name = “trend”
Form.status = “fetching”

Then; at the end of the workflow, reset the form variable.

Bind the display of the loader to form name of item and status of fetching.

I use this same variable for loading pop up modals, editing data, etc. it’s very handy.

2 Likes

Wow! Love that you did that, Kevin!

I have a separate boolean variable for each workflow but love your approach of passing the form name to an object variable :heart_eyes:

Just added it as a pro tip in the user doc! :grinning:

2 Likes

I am curious to learn what’s in the User doc :eyes: but I got a 404. Is the user doc still available?

Thanks for reporting it! Just updated the link :slight_smile:

This is great thank you!

Just to follow up now with components, is there a good way of creating a component that allows for the same? Would be great to not have to add a fetching variable before and after every single workflow.