headlamp icon indicating copy to clipboard operation
headlamp copied to clipboard

useList, useGet hooks unexpected behaviour & UseList items any type

Open callmevladik opened this issue 1 year ago • 2 comments

Some time ago, I wrote about not being able to know the loading status of a request, so someone from headlamp team told me that in these hooks, null values are default values, so if value is null then it is loading. It worked with useList everywhere, but recently I needed to use same logic with useGet and it behaves differently, useGet always returns null when request has 404 status(resource not found) and also from the start as a default value.

Also, it is worth to mention that "any" type in useList items return is kinda bad thing. image

One more thing, just a thought, maybe headlamp should have react-query under the hood and use it in its hooks ?

It would make dealing with requests and streams much easier.

callmevladik avatar Jan 25 '24 16:01 callmevladik

Thanks @callmevladik for reporting this I will take a look into this

ashu8912 avatar Jan 30 '24 12:01 ashu8912

@ashu8912 Maybe this has to do with #1591 .

joaquimrocha avatar Jan 31 '24 13:01 joaquimrocha