DEV Community

Discussion on: Displaying a css spinner on ajax calls with fetch api

Collapse
 
bgadrian profile image
Adrian B.G.

You did a common mistake, to not hide the spinner at error, see promise.catch().

I know that error handling is a tabu subject in the JS ecosystem, but we should change this.

Collapse
 
wangonya profile image
Kelvin Wangonya

Didnโ€™t know about promise.catch. Iโ€™ll check it out. Thanks!

Collapse
 
lcherpit profile image
Laurent C.

At least use ".finally()" to hide spinner at the end of process. Indeed, ".then()" will never called on error and spinner will stay stuck.