Fix: don't initialize workpad from WorkpadApp (#32163) (#32173)

Closes https://github.com/elastic/kibana/issues/32161

All the elements are loaded in the router, so loading the from the component just duplicates the work.

This is actually left-over code from before we had a router. Apparently I missed this lifecycle when adding the router, so it's been an issue in Canvas for quite some time now.

### Stats

Workpad | Previous load time | PR load time
-- | -- | -- 
Elastic{ON} Tour Dallas: Canvas v3 | 10 seconds | 7 seconds
Kibana Canvas - Your data, your way. | 32 seconds | 18 seconds

*Time from when the Canvas loading indicator goes away and the workpad app renders to when the loading indicator stops spinning*
This commit is contained in:
Clint Andrew Hall 2019-02-27 23:48:54 -06:00 committed by GitHub
parent 08c5efb8ea
commit 58b37bd8a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 9 deletions

View file

@ -6,7 +6,6 @@
import { connect } from 'react-redux';
import { compose, branch, renderComponent } from 'recompose';
import { initializeWorkpad } from '../../../state/actions/workpad';
import { selectElement } from '../../../state/actions/transient';
import { canUserWrite, getAppReady } from '../../../state/selectors/app';
import { getWorkpad, isWriteable } from '../../../state/selectors/workpad';
@ -24,9 +23,6 @@ const mapStateToProps = state => {
};
const mapDispatchToProps = dispatch => ({
initializeWorkpad() {
dispatch(initializeWorkpad());
},
deselectElement(ev) {
ev && ev.stopPropagation();
dispatch(selectElement(null));

View file

@ -15,13 +15,8 @@ export class WorkpadApp extends React.PureComponent {
static propTypes = {
isWriteable: PropTypes.bool.isRequired,
deselectElement: PropTypes.func,
initializeWorkpad: PropTypes.func.isRequired,
};
componentDidMount() {
this.props.initializeWorkpad();
}
render() {
const { isWriteable, deselectElement } = this.props;