You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I saw the existence of isLoading, I assumed it would be true from the moment the react-async component mounted until the query promise I provided was completed. Instead, though, isLoading is momentarily false for the first render or so, until the state has had a chance to update, because the component doesn't know that a promiseFn was necessarily provided.
Two options I see:
on construction, set isLoading to true if there is a promiseFn provided and it produces a promise
naming clarity: provide a new param, isReady that is set to !!finishedAt
provision of some kind of warning in the documentation about isLoading not being true initially.
The first option is probably the most intuitive for the user.
The text was updated successfully, but these errors were encountered:
Thanks for the feedback, I love to hear about these unexpected/unclear behaviors. As I was developing it, I did initially have isLoading set to true on mount. I changed that when I added the deferFn, because in that scenario, isLoading=true doesn't apply on mount. I like your first suggestion best. I think it does make sense in most use cases and it's what people would expect.
Uh oh!
There was an error while loading. Please reload this page.
When I saw the existence of
isLoading
, I assumed it would be true from the moment the react-async component mounted until the query promise I provided was completed. Instead, though, isLoading is momentarily false for the first render or so, until the state has had a chance to update, because the component doesn't know that a promiseFn was necessarily provided.Two options I see:
isReady
that is set to!!finishedAt
isLoading
not being true initially.The first option is probably the most intuitive for the user.
The text was updated successfully, but these errors were encountered: