remote-data-ts icon indicating copy to clipboard operation
remote-data-ts copied to clipboard

Question about pending state

Open bmadone opened this issue 2 years ago • 1 comments

How to separate state when I do first loading, and show skeleton, and second+ loading, when I don't want to hide my content, is it possible?

bmadone avatar Aug 25 '22 15:08 bmadone

Simply put your data in a separate variable and update it when the response was returned.

So instead of using a single RemoteData object would do some like this:

// Before
type Response = RemoteData<Error, Data>

// After
interface Response {
  data: Option<Data> // Is None on first load
  request: RemoteData<Error, void> // You can remove data from the RemoteData object or keep it twice.
}

mlegenhausen avatar Aug 29 '22 08:08 mlegenhausen