-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
🎄 dependencies🌹 has-reproduction🏓 awaiting-contributor-responserequires input from a contributorrequires input from a contributor
Description
Issue Description
https://community.apollographql.com/t/preloadquery-without-topromise-in-v4/9409/4
loader: async ({ params }) => {
const queryRef = preloadQuery(Deal_Query, {
fetchPolicy: 'cache-and-network',
variables: { dealId: params.dealId }, // <--- When `params.dealId` changes the queryRef doesn't update
});
return preloadQuery.toPromise(queryRef);
},
Workaround
loader: async ({ params }) => {
const queryRef = preloadQuery(Deal_Query, {
fetchPolicy: 'cache-and-network',
variables: { dealId: params.dealId },
});
const q = await preloadQuery.toPromise(queryRef);
// @ts-expect-error
q.dealId = params.dealId;
return q;
},
Link to Reproduction
none
Reproduction Steps

@apollo/client
version
4.0.2
Metadata
Metadata
Assignees
Labels
🎄 dependencies🌹 has-reproduction🏓 awaiting-contributor-responserequires input from a contributorrequires input from a contributor