File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,16 @@ import classnames from 'classnames';
44import find from 'lodash/find' ;
55import ErrorList from './ErrorList' ;
66
7- function ErrorReport ( { errors, onErrorClick} ) {
7+ function ErrorReport ( { errors, isValidating, onErrorClick} ) {
8+ if ( isValidating ) {
9+ return < div className = "output__delayed-error-overlay" /> ;
10+ }
11+
12+ const hasErrors = Boolean ( find ( errors , list => list . items . length ) ) ;
13+ if ( ! hasErrors ) {
14+ return null ;
15+ }
16+
817 const isDocked = Boolean ( find ( errors , { state : 'runtime-error' } ) ) ;
918 const { html, css, javascript} = errors ;
1019
@@ -41,6 +50,7 @@ ErrorReport.propTypes = {
4150 html : PropTypes . object . isRequired ,
4251 javascript : PropTypes . object . isRequired ,
4352 } ) . isRequired ,
53+ isValidating : PropTypes . bool . isRequired ,
4454 onErrorClick : PropTypes . func . isRequired ,
4555} ;
4656
Original file line number Diff line number Diff line change @@ -4,21 +4,7 @@ import {t} from 'i18next';
44import classnames from 'classnames' ;
55import { ErrorReport , Preview } from '../containers' ;
66
7- const errorStates = new Set ( [ 'validation-error' , 'runtime-error' ] ) ;
8-
97class Output extends React . Component {
10- _renderErrors ( ) {
11- if ( this . props . validationState === 'validating' ) {
12- return < div className = "output__delayed-error-overlay" /> ;
13- }
14-
15- if ( errorStates . has ( this . props . validationState ) ) {
16- return < ErrorReport /> ;
17- }
18-
19- return null ;
20- }
21-
228 render ( ) {
239 const {
2410 isDraggingColumnDivider,
@@ -46,7 +32,7 @@ class Output extends React.Component {
4632 { t ( 'workspace.components.output' ) }
4733 </ div >
4834 < Preview />
49- { this . _renderErrors ( ) }
35+ < ErrorReport />
5036 </ div >
5137 </ div >
5238 ) ;
@@ -57,7 +43,6 @@ Output.propTypes = {
5743 isDraggingColumnDivider : PropTypes . bool . isRequired ,
5844 isHidden : PropTypes . bool . isRequired ,
5945 style : PropTypes . object . isRequired ,
60- validationState : PropTypes . string . isRequired ,
6146 onHide : PropTypes . func . isRequired ,
6247 onRef : PropTypes . func . isRequired ,
6348} ;
Original file line number Diff line number Diff line change @@ -228,7 +228,6 @@ class Workspace extends React.Component {
228228 isDraggingColumnDivider = { isDraggingColumnDivider }
229229 isHidden = { includes ( hiddenUIComponents , 'output' ) }
230230 style = { { flex : rowsFlex [ 1 ] } }
231- validationState = { this . _getOverallValidationState ( ) }
232231 onHide = {
233232 partial ( this . _handleComponentHide ,
234233 'output' )
Original file line number Diff line number Diff line change @@ -3,7 +3,16 @@ import {ErrorReport} from '../components';
33import { focusLine } from '../actions' ;
44
55function mapStateToProps ( state ) {
6- return { errors : state . get ( 'errors' ) . toJS ( ) } ;
6+ return {
7+ errors : state . get ( 'errors' ) . toJS ( ) ,
8+ isValidating : Boolean (
9+ state . getIn ( [ 'ui' , 'editors' , 'typing' ] ) &&
10+ state . get ( 'errors' ) . find (
11+ error => error . get ( 'state' ) === 'validation-error' ,
12+ ) ||
13+ state . get ( 'errors' ) . find ( error => error . get ( 'state' ) === 'validating' ) ,
14+ ) ,
15+ } ;
716}
817
918function mapDispatchToProps ( dispatch ) {
You can’t perform that action at this time.
0 commit comments