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
Is your enhancement related to a problem? Please describe.
When there is no data to return from useFetchPosts and a NotFoundError is returned instead, the loading property is still set to true.
For components that are relying on this property to display some sort of loading state, this can mean that they display that loading state indefinitely. An example of this can be seen in the RelatedPosts component of wp-nextjs-app.
useFetch returns an accurate isLoading property to useFetchPosts, however, useFetchPosts does not use this and instead generates its own loading property. Components like RelatedPosts will then assume that if useFetchPosts isn't loading, it must have data. However, there is also the possibility that it is done loading and just has not found any data.
I'm not sure if we can change this behavior without breaking things since there may be components that are built with this existing behavior in mind, but it would be nice to be able to know if something is done loading, even if it doesn't return results.
Designs
No response
Describe alternatives you've considered
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Is your enhancement related to a problem? Please describe.
When there is no data to return from
useFetchPosts
and aNotFoundError
is returned instead, theloading
property is still set totrue
.For components that are relying on this property to display some sort of loading state, this can mean that they display that loading state indefinitely. An example of this can be seen in the
RelatedPosts
component of wp-nextjs-app.https://share.zight.com/v1uq5KWZ
useFetch
returns an accurateisLoading
property touseFetchPosts
, however,useFetchPosts
does not use this and instead generates its ownloading
property. Components likeRelatedPosts
will then assume that ifuseFetchPosts
isn'tloading
, it must have data. However, there is also the possibility that it is done loading and just has not found any data.I'm not sure if we can change this behavior without breaking things since there may be components that are built with this existing behavior in mind, but it would be nice to be able to know if something is done loading, even if it doesn't return results.
Designs
No response
Describe alternatives you've considered
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: