Skip to content
This repository was archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
Stop serializing requests in QwikExchange
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinJSilk committed Oct 17, 2022
1 parent 69041c2 commit d49bb81
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/exchange/qwik-exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AnyVariables, Exchange, Operation, OperationResult } from '@urql/core';
import { pipe, tap } from 'wonka';

type Query = {
request: Operation<any, AnyVariables>;
key: number;
response: Omit<OperationResult<any, AnyVariables>, 'operation'>;
trigger: { value: number };
};
Expand All @@ -23,7 +23,7 @@ class QwikExchange {
constructor(private readonly cache: Cache) {
if (!isServer) {
for (const query of Object.values(this.cache.queries)) {
this.setDependencies(query.request.key, query.response);
this.setDependencies(query.key, query.response);
}
}
}
Expand Down Expand Up @@ -83,16 +83,8 @@ class QwikExchange {
* the client, and a trigger signal to force a refetch
*/
private cacheRequest(operation: Operation) {
// Remove non-serializeable fields. Must copy first to avoid removing from
// the original object
const contextCopy = { ...operation.context };
delete contextCopy.fetch;

this.cache.queries[operation.key] = {
request: {
...operation,
context: contextCopy,
},
key: operation.key,
response: operation.context.store,
trigger: operation.context.trigger,
};
Expand Down

0 comments on commit d49bb81

Please sign in to comment.