-
Notifications
You must be signed in to change notification settings - Fork 8
Description
It's been a while since @amcgee and I talked about this. I'll recap: in the scheduler I have two components that request data but the endpoint isn't known in advance, so I can't create a static query.
I initially created a custom hook using the data engine, but that replicated a lot of the logic that's also in the app-runtime, which seemed contrary to the purpose of the app-runtime to me. For simplicity I'm now using something that's a bit of a hack (see here):
const query = {
options: {
resource: '/',
id: ({ id }) => id,
params: {
paging: false,
},
},
}So I'm abusing the id to set the resource dynamically. This is a bit of a hack, and does not seem like a stable solution to me. My question is, could we support dynamic queries via the useDataQuery hook?
When we talked about it I mentioned that I'd report back after the app was a bit more feature complete. At the moment we've implemented a lot of the app's final functionality and the above usecase seems like a valid one to me.
The useDataQuery and useDataMutation hooks have worked for most of the fetching we need to do, except for the above (and one other edge case). It would be nice if the above could also be addressed with the useDataQuery hook. Seems nice to be able to address everything with a single mechanism.
(I could also just be missing a way in which the above is already officially supported by the way, let me know if that's the case.)