Next.js Discord

Discord Forum

Skeleton loading with dynamic search results from API response

Unanswered
alejandro posted this in #help-forum
Open in Discord
Hello,

When fetching data from API, the response has 20 items, a known number, but when you search or filter using web app user interface, you don’t know the amount of results that will come in the response.

So how many skeleton cards you should show? For example: if you show 20 skeleton cards when loading (fetching data from API), and the response has 4 items, it seems a bit confusing to the user.

Does anyone know a technique for displaying skeleton cards with dynamic search results (you don’t know the number of results that will come in the API response)?

3 Replies

I wouldn't do stuff like that.
Just just do a basic simple loader, not something that is based on length of the api response data
Depending on the UI you got, you could also show a fixed small amount of skeletons (2/4) instead of like a spinner