Is it possible to call the loader function passing parameters that are not in the URL? #9964
Unanswered
FranciscoGileno
asked this question in
Q&A
Replies: 2 comments 1 reply
-
@FranciscoGileno How did you structure your app to have apollo |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @bodokaiser . That's just a export / import.. On lib/apollo export const client = new ApolloClient({
link: ApolloLink.from([redirectLink, commonLink]),
cache,
defaultOptions
}) On Loader: import { client } from 'lib/apollo'
...
export async function loader({ request }) {
const url = new URL(request.url)
const variables = parseSearchParams(url.search)
const queryResponse = await client.query(myQuery, { variables })
return json(queryResponse.data)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a loader function that calls the apollo client to fetch the data:
client.query
caches the result, so if the same search params are sent, it gets from the cache.For 99% of the time, it works great.
But when I click on the Refresh button, I don't want to use the cache for the same search params.
If I call
navigate
passing the search Param:refresh=true
, I can get this parameter in the loader and query from server. However, this parameter will appear in the URL, which I prefer not to.Is it possible to call the loader function passing parameters that are not in the URL?
Beta Was this translation helpful? Give feedback.
All reactions