-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Hi, I love the getData
and useResource
pattern, the DX would be really nice for straight fetching data.
Relay doesn't set up its API in a way that would work nicely with this approach. It has two main functions:
// In your routes
const queryRef = loadQuery(/* ... */);
// In your component
const { data } = usePreloadedQuery(queryRef, /*... */);
Instead of using a promise to figure out if the fetch is complete, it uses a reference that acts as a handle on the request. This would work okay (if a bit strange) with getData
and useResource
, I could just ignore the loading and error statuses. Except that the queryRef
needs to be actively disposed when it is no longer displayed.
Potentially a solution would be to add a more customisable get
and dispose
combo of options to the router config.
tatchi
Metadata
Metadata
Assignees
Labels
No labels