preloadQuery without toPromise in v4

That’s odd :thinking:

Just to double check that its returning different query refs, can you add a property on the queryRef to make sure you’re getting different values returned from the loader?

loader: async ({ params }) => {
  // ...

  const q = await preloadQuery.toPromise(queryRef);
  // @ts-ignore
  q.dealId = params.dealId
  return q;
}

function RouteComponent() {
  const dealQueryRef = Route.useLoaderData();
  // @ts-ignore
  console.log(dealQueryRef.dealId);
}

If this looks correct, would you mind filing a bug in the @apollo/client repo? I’d like to investigate further. We really didn’t change anything related specifically to preloadQuery, though we did switch around the internals on the core API so perhaps we missed something.

1 Like