From 64ae142e1dc6e7915099a744f83d921ba26e78db Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Thu, 31 Aug 2017 02:03:15 +0530 Subject: [PATCH] fix graphql --- components/ConversionPanel.js | 16 ++++++++++------ pages/graphql-to-flow.js | 2 +- pages/graphql-to-typescript.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/ConversionPanel.js b/components/ConversionPanel.js index 3aa704d..a1b4029 100644 --- a/components/ConversionPanel.js +++ b/components/ConversionPanel.js @@ -83,11 +83,15 @@ export default class ConversionPanel extends PureComponent { } onChange = (newValue: string, leftSplitValue: string) => { + const nValue = newValue || this.state.value; + const splitValue = + leftSplitValue && typeof leftSplitValue === "string" + ? leftSplitValue + : this.state.splitValue; + + debugger; try { - const code = this.props.getTransformedValue( - newValue || this.state.value, - leftSplitValue || this.state.splitValue - ); + const code = this.props.getTransformedValue(nValue, splitValue); this.setState({ resultValue: code, @@ -104,8 +108,8 @@ export default class ConversionPanel extends PureComponent { } this.setState({ - value: newValue || this.state.value, - splitValue: leftSplitValue || this.state.splitValue + value: nValue, + splitValue: splitValue }); }; diff --git a/pages/graphql-to-flow.js b/pages/graphql-to-flow.js index 4539e76..62f1a92 100644 --- a/pages/graphql-to-flow.js +++ b/pages/graphql-to-flow.js @@ -13,7 +13,7 @@ export default class Json2Ts extends PureComponent { return (