Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(apollo-utilities): unstable stringify key #2869

Merged
merged 11 commits into from
Jun 1, 2018
4 changes: 4 additions & 0 deletions packages/apollo-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
"minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js",
"filesize": "npm run build && npm run build:browser"
},
"dependencies": {
"json-stable-stringify": "1.0.1"
},
"devDependencies": {
"@types/json-stable-stringify": "1.0.32",
"@types/graphql": "0.12.5",
"@types/jest": "21.1.10",
"@types/lodash": "4.14.105",
Expand Down
3 changes: 3 additions & 0 deletions packages/apollo-utilities/src/storeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
NameNode,
} from 'graphql';

import * as stringify from 'json-stable-stringify';

export interface IdValue {
type: 'id';
id: string;
Expand Down Expand Up @@ -216,6 +218,7 @@ export function getStoreKeyName(
let completeFieldName: string = fieldName;

if (args) {
const stringifiedArgs: string = stringify(args);
const stringifiedArgs: string = JSON.stringify(args);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be removed (rebase/merge problem)

completeFieldName += `(${stringifiedArgs})`;
}
Expand Down