Failing Background Refetches on Edit Pages for Nested Resources
I'm working with nested resources and I'm running into an issue on my edit pages where the initial data load works correctly, but all subsequent background refetches (like on window focus or when using the <RefreshButton>) fail with a 404 error.
The Setup:
I have three levels of nested resources:
1.
2.
3.
My API endpoints for these nested resources look like this:
-
-
The Problem:
When I navigate to an edit page for a nested resource, like
However, any subsequent background refetches triggered by Refine (e.g., on window focus or by clicking the refresh button) fail because they call the wrong URL:
It seems the
What I've Tried:
I have correctly configured the
Thanks.
The Setup:
I have three levels of nested resources:
1.
competitions2.
sessions (nested under competitions)3.
events (nested under sessions)My API endpoints for these nested resources look like this:
-
/api/competitions/{competitionId}/sessions/{sessionId}-
/api/competitions/{competitionId}/sessions/{sessionId}/events/{eventId}The Problem:
When I navigate to an edit page for a nested resource, like
/competitions/1/sessions/edit/1, the initial GET request to fetch the data works perfectly: GET https://lsc-api.mydomain.ca/api/competitions/1/sessions/1 (200 OK)However, any subsequent background refetches triggered by Refine (e.g., on window focus or by clicking the refresh button) fail because they call the wrong URL:
GET https://api.mydomain.ca/api/sessions/1 (404 Not Found)It seems the
meta object with the parent resource information is not being passed to these background refetches.What I've Tried:
I have correctly configured the
useForm hook in my edit pages to pass the meta object to both the refineCoreProps (for the update mutation) and the queryOptions (for the initial getOne query). This is why the initial load and the form submission work correctly.Thanks.
