From 40f5f134e19b4e0107fdf845103099e945761ae9 Mon Sep 17 00:00:00 2001 From: "Ilya Ig. Petrov" Date: Fri, 26 May 2017 07:35:04 -0700 Subject: [PATCH] Fix bug with InfernoJS --- .../pages/options/src/components/Main.js | 1 - .../pages/options/src/components/ModList.js | 4 ---- .../options/src/components/ProxyEditor.js | 23 +++++++++++++++---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Main.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Main.js index daafc8f..3e6c1a7 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Main.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Main.js @@ -80,7 +80,6 @@ export default function getMain(theState) { if (targetIndex !== index) { return conf; } - console.log(`${conf.key} := ${newValue}`); return Object.assign({}, conf, { value: newValue }); diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js index 1bfb365..c0aaa4b 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ModList.js @@ -20,10 +20,8 @@ export default function getModList(theState) { handleCheck(confMeta, ifChecked) { - console.log('handle CHECK:', ifChecked); this.state.checks[confMeta.index] = ifChecked; if (ifChecked === false || !confMeta.ifChild) { - console.log('NO CHILD OR FALSE', confMeta); this.handleNewValue(confMeta, ifChecked); } else { this.setState({ @@ -37,7 +35,6 @@ export default function getModList(theState) { handleNewValue({ conf, index }, newValue) { - console.log('handle NEW VALUE', conf.key, newValue); this.props.onConfChanged({ targetConf: conf, targetIndex: index, @@ -62,7 +59,6 @@ export default function getModList(theState) { Object.assign({}, props, {conf, onNewValue: (newValue) => this.handleNewValue(confMeta, newValue)}) ); - console.log('CHIIIIILD', child); return ( this.setState({ifExportsMode: !this.state.ifExportsMode}); - this.mayEmitNewValue(oldValue, newValue); + waitingNewValues.push(newValue); // Wait till mount or eat bugs. } + componentDidMount() { + + if (waitingNewValues.length) { + this.mayEmitNewValue(this.props.value, waitingNewValues.pop()); + waitingNewValues = []; + } + + } + + componentDidUnmount() { + + waitingNewValues = []; + + } + mayEmitNewValue(oldValue, newValue) { - console.log('emit?', oldValue, 'vs', newValue); if ( // Reject: 1) both `false` OR 2) both `===`. ( Boolean(oldValue) || Boolean(newValue) ) && oldValue !== newValue ) { - console.log('EMIT'); this.props.onNewValue(newValue); } @@ -504,7 +518,6 @@ PROXY foobar.com:8080; # Not HTTP!`.trim()} }, }, originalProps); - return createElement(ExportsEditor, props); return this.state.ifExportsMode ? createElement(ExportsEditor, props) : createElement(TabledEditor, props);