vocdoni / explorer

Vocdoni's Blockchain Explorer
https://dev.explorer.vote
GNU Affero General Public License v3.0
1 stars 0 forks source link

Don't show loading on refetch if previous call was an error #46

Open selankon opened 4 months ago

selankon commented 4 months ago

Not sure if I should give attention to this because is an edge case. Sometimes when stg is restarted and the block deoesn't exists anymore, if you try to access to the firsts blocks a 404 error is shown.

This is normal, block is not found because it doesn't exist anymore, is a backend issue.

The problem here is that when block height changes and the block list is refetched, the placeholder is shown again (showing previous loaded list).

I didn't found a way to fix this at first moment, which is so strange that react query didn't think about this case. I don't want to show the placeholder data blinking between refetch if an error is shown until the next call is success.

I looked at ReactQuery docs without success, and a way I though to do this is to create a previous state like previousCallWasAnError or similar, which sounds odd and buggie.

https://tanstack.com/query/latest/docs/framework/react/guides/paginated-queries#better-paginated-queries-with-placeholderdata

I find that if I add a refetch interval into the process list page, and i search by a process that doesn't exist, the behavior is the same.

I let this open FTR and lets see if needs attention

selankon commented 3 months ago

This could help to the error because placeholder will content data

https://github.com/vocdoni/ui-components/pull/189