From ce38b9da6483a780aa369b59ead6eb69b4d3aef3 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 8 May 2017 19:41:14 +0700 Subject: [PATCH] Rename argument name --- client/coral-framework/hocs/withMutation.js | 6 +++--- client/coral-framework/hocs/withQuery.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/coral-framework/hocs/withMutation.js b/client/coral-framework/hocs/withMutation.js index 81529faea..9c5bad8fd 100644 --- a/client/coral-framework/hocs/withMutation.js +++ b/client/coral-framework/hocs/withMutation.js @@ -9,14 +9,14 @@ import {getDefinitionName} from '../utils'; * Exports a HOC with the same signature as `graphql`, that will * apply mutation options registered in the registry. */ -export default (definitions, config) => WrappedComponent => { +export default (document, config) => WrappedComponent => { config = { ...config, options: config.options || {}, props: config.props || (data => ({mutate: data.mutate()})), }; const wrappedProps = (data) => { - const name = getDefinitionName(definitions); + const name = getDefinitionName(document); const callbacks = getMutationOptions(name); const mutate = (base) => { const variables = base.variables || config.options.variables; @@ -73,6 +73,6 @@ export default (definitions, config) => WrappedComponent => { }; return config.props({...data, mutate}); }; - const wrapped = graphql(definitions, {...config, props: wrappedProps})(WrappedComponent); + const wrapped = graphql(document, {...config, props: wrappedProps})(WrappedComponent); return wrapped; }; diff --git a/client/coral-framework/hocs/withQuery.js b/client/coral-framework/hocs/withQuery.js index 575a4484f..42dfe7b35 100644 --- a/client/coral-framework/hocs/withQuery.js +++ b/client/coral-framework/hocs/withQuery.js @@ -6,7 +6,7 @@ import {getDefinitionName, separateDataAndRoot} from '../utils'; * Exports a HOC with the same signature as `graphql`, that will * apply query options registered in the registry. */ -export default (definitions, config) => WrappedComponent => { +export default (document, config) => WrappedComponent => { config = { ...config, options: config.options || {}, @@ -15,7 +15,7 @@ export default (definitions, config) => WrappedComponent => { const wrappedOptions = (data) => { const base = (typeof config.options === 'function') ? config.options(data) : config.options; - const name = getDefinitionName(definitions); + const name = getDefinitionName(document); const configs = getQueryOptions(name); const reducerCallbacks = [base.reducer || (i => i)] @@ -33,6 +33,6 @@ export default (definitions, config) => WrappedComponent => { }; }; - const wrapped = graphql(definitions, {...config, options: wrappedOptions})(WrappedComponent); + const wrapped = graphql(document, {...config, options: wrappedOptions})(WrappedComponent); return wrapped; };