diff --git a/package-lock.json b/package-lock.json index d1f9f3a2a62..11b7c112b95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6654,7 +6654,8 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", diff --git a/package.json b/package.json index 29da62edc3e..8b1fc04951d 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@wry/context": "^0.6.0", "@wry/equality": "^0.4.0", "@wry/trie": "^0.3.0", - "fast-json-stable-stringify": "^2.0.0", "graphql-tag": "^2.12.3", "hoist-non-react-statics": "^3.3.2", "optimism": "^0.16.1", diff --git a/src/utilities/graphql/storeUtils.ts b/src/utilities/graphql/storeUtils.ts index 31c9513fb8d..6ef388baf03 100644 --- a/src/utilities/graphql/storeUtils.ts +++ b/src/utilities/graphql/storeUtils.ts @@ -17,7 +17,6 @@ import { SelectionSetNode, } from 'graphql'; -import stringify from 'fast-json-stable-stringify'; import { InvariantError } from 'ts-invariant'; import { FragmentMap, getFragmentFromSelection } from './fragments'; @@ -181,6 +180,7 @@ export function getStoreKeyName( fieldName: string, args?: Record | null, directives?: Directives, + stringify: (value: any) => string = JSON.stringify, ): string { if ( args && @@ -202,7 +202,7 @@ export function getStoreKeyName( filteredArgs[key] = args[key]; }); - return `${directives['connection']['key']}(${JSON.stringify( + return `${directives['connection']['key']}(${stringify( filteredArgs, )})`; } else { @@ -224,7 +224,7 @@ export function getStoreKeyName( Object.keys(directives).forEach(key => { if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; if (directives[key] && Object.keys(directives[key]).length) { - completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; + completeFieldName += `@${key}(${stringify(directives[key])})`; } else { completeFieldName += `@${key}`; }