-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useFetcher: request.url references fetcher url for resource routes. #5328
Comments
This is expected behavior.
Can you provide an explanation of your use case here? This feels like a case where you want to actively re-call the fetcher based on certain search params changing which feels like something you'd be able to wire up via an |
@brophdawg11 Using I kind of figured needing the fetcher's URL may be the case. What about the |
I don't think It sounds like you're looking for something different so you can change the behavior of a resource route loader based on the next location it's being called for. I do think this is something that can be made into a utility in user-land so would love to see what you come up with. But if you have a specific case where this is insufficient feel free to write up a proposal for consideration over in React Router (all the fetcher code lives there now). |
What version of Remix are you using?
1.12.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Kind of a follow up to #5091. Add a useFetcher to a route, create a resource route for that fetcher to load data from. Inside of the resource routes loader function,
request.url
is the url of the fetcher, not the active location/route a user is making the request from, andrequest.headers.get('referer')
is a active url before the revalidation has taken place (i.e. it doesn't include the changes).Expected Behavior
In line with #5091, like
currentUrl
andcurrentParams
in the shouldRevalidate function now referencing the active location (an update a part of 1.12.0 I believe). I think thatrequest.url
in a resource route should also follow that same thinking. For my use case I need to be able to get the query params from within the resource routes loader - the only other way I can see is using thereferer
header, but that shows the previous URL before the search params changed (perhaps that's the actual bug here).Actual Behavior
Currently the
request.url
just shows the url of the resource route, and the referer url references the old URL before whatever changes happened to revalidate the fetcher.e.g.
I understand the search params could be added to the fetcher but that would bypass the resource routes shouldRevalidate logic and any revalidation logic would have to exist wherever the fetcher.load is being called.
The text was updated successfully, but these errors were encountered: