Skip to content

Commit

Permalink
fix: dataloader cacheKeyFn bigint problem
Browse files Browse the repository at this point in the history
  • Loading branch information
boxcc authored and doug-martin committed Oct 23, 2020
1 parent 031012e commit 92171dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/query-graphql/src/loader/dataloader.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export class DataLoaderFactory {
const nestjsQueryLoaders = this.initializeContext(context);
if (!nestjsQueryLoaders[name]) {
// eslint-disable-next-line no-param-reassign
nestjsQueryLoaders[name] = new Dataloader(handler, { cacheKeyFn: (key) => JSON.stringify(key) });
nestjsQueryLoaders[name] = new Dataloader(handler, {
cacheKeyFn: (key) =>
JSON.stringify(key, (_, v) => (typeof v === 'bigint' ? v.toString() : v)),
});
}
return nestjsQueryLoaders[name] as Dataloader<K, V>;
}
Expand Down

0 comments on commit 92171dc

Please sign in to comment.