From c2b488fa98bb9b98f12166523c0fdc8a6321116e Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 1 Dec 2017 17:11:38 +0100 Subject: [PATCH] Don't use murmurhash --- .../coral-framework/graphql/reduceDocument.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/client/coral-framework/graphql/reduceDocument.js b/client/coral-framework/graphql/reduceDocument.js index d3d5990bf..12e0954d7 100644 --- a/client/coral-framework/graphql/reduceDocument.js +++ b/client/coral-framework/graphql/reduceDocument.js @@ -6,10 +6,24 @@ import { getOperationDefinition, } from 'apollo-utilities'; -import {murmur3} from 'murmurhash-js'; - function getDirectivesID(directives) { - return murmur3(JSON.stringify(directives)); + let id = ''; + directives.forEach((directive) => { + id += `@${directive.name.value}(`; + let first = true; + directive.arguments.forEach((arg) => { + if (!first) { + id += ','; + } + first = false; + const value = arg.value.kind === 'Variable' + ? `$${arg.value.name.value}` + : arg.value.value; + id += `${arg.name.value}:${value}`; + }); + id += ')'; + }); + return id; } // If two definitions have the same id, they can be merged.