Open rpelissier opened 2 years ago
@rpelissier Apologies for the delay. Can you share the code example where you need to pass a Promise<Query>
to useObject
?
I accomplish this with other hook-based data fetching libraries (like urql) with a disabled
flag. So I can have something like:
const [userData, userLoading, userError] = useQuery(blah);
const [otherUserData] = useQuery(query_using_userData_somehow, { disabled: !!userData })
Would be nice to have in this lib too. Working around it with nested components is a pain.
would definitely make lives easier when trying to fetch data that is dependant on previously fetched data...
I have a use case that make the use of
useObject
quite painful. It happens that the path of theQuery
is depending on another request to the Database. As conditional Hooks are forbidden I have to create every time another layer of Component to do the first query before I can use the secundary Component with your hook. It would be great ifquery
can optionaly be aPromise<Query>
so I don't need this extra layer.Example code :