mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
Rename argument name
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user