From aef50ab5850df85b0ff0202235d317415930554c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 2 Apr 2020 10:25:00 -0400 Subject: [PATCH] fix(@embark/cockpit): fix console not rendering with ganache and not showing blockchain when removing the data-wrapper --- packages/cockpit/ui/src/components/Console.js | 28 ++++++++++++++---- .../ui/src/containers/HomeContainer.js | 29 +++++++++---------- packages/cockpit/ui/src/sagas/index.js | 2 +- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/packages/cockpit/ui/src/components/Console.js b/packages/cockpit/ui/src/components/Console.js index bac4783f79..e00cc97293 100644 --- a/packages/cockpit/ui/src/components/Console.js +++ b/packages/cockpit/ui/src/components/Console.js @@ -16,11 +16,29 @@ const convert = new Convert({newline: true, escapeXML: true}); class Console extends Component { constructor(props) { super(props); + + this.state = { + value: '', + isLoading: true, + options: [], + activeTab: EMBARK_PROCESS_NAME, + processes: this.getProcesses() + }; + } + + getProcesses() { // Add embark to the start of the list - this.processes = [...props.processes]; - this.processes.unshift({name: 'embark', state: 'running'}); + const processes = [...this.props.processes]; + processes.unshift({name: 'embark', state: 'running'}); + return processes; + } - this.state = {value: '', isLoading: true, options: [], activeTab: EMBARK_PROCESS_NAME}; + componentDidUpdate(prevProps) { + if (prevProps.processes.length !== this.props.processes.length) { + this.setState({ + processes: this.getProcesses() + }); + } } handleSubmit(event) { @@ -52,7 +70,7 @@ class Console extends Component { renderNav() { return (