Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.3k
React 16.13#1145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
React 16.13 #1145
Changes from all commits
ddb3f9bf187c0c7ee674bf9b180f67e18e7d811a448b52d41dc46d06bf2650da4a015f1fe5fad6102887602ac9ecfeba323d5942b942975b517cf28b341ef4c9ea949f6ea5e24496ebaeed7b52File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -102,6 +102,7 @@ | ||
| "no-new-wrappers": ["error"], | ||
| "no-param-reassign": ["error"], | ||
| "no-process-env": ["warn"], | ||
| "no-prototype-builtins": ["off"], | ||
| "no-proto": ["error"], | ||
| "no-redeclare": ["error"], | ||
| "no-return-assign": ["error"], | ||
| @@ -141,7 +142,7 @@ | ||
| }], | ||
| "no-magic-numbers": ["error", { | ||
| "ignoreArrayIndexes": true, | ||
| "ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25] | ||
| "ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25, 200, 500] | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some xhr return codes | ||
| }], | ||
| "no-underscore-dangle": ["off"], | ||
| "no-useless-escape": ["off"] | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import {connect} from 'react-redux'; | ||
| import {includes, isEmpty, isNil} from 'ramda'; | ||
| import React, {Component} from 'react'; | ||
| import React, {useEffect, useState} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import TreeContainer from './TreeContainer'; | ||
| import GlobalErrorContainer from './components/error/GlobalErrorContainer.react'; | ||
| @@ -17,24 +17,13 @@ import {STATUS} from './constants/constants'; | ||
| /** | ||
| * Fire off API calls for initialization | ||
| * @param {*} props props | ||
| * @returns {*} component | ||
| */ | ||
| class UnconnectedContainer extends Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.initialization = this.initialization.bind(this); | ||
| this.state = { | ||
| errorLoading: false, | ||
| }; | ||
| } | ||
| componentDidMount() { | ||
| this.initialization(this.props); | ||
| } | ||
| componentWillReceiveProps(props) { | ||
| this.initialization(props); | ||
| } | ||
| const UnconnectedContainer = props => { | ||
| const [errorLoading, setErrorLoading] = useState(false); | ||
| initialization(props) { | ||
| useEffect(() => { | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rewriting the ApiController as a functional component allows the use of | ||
| const { | ||
| appLifecycle, | ||
| dependenciesRequest, | ||
| @@ -81,74 +70,65 @@ class UnconnectedContainer extends Component { | ||
| // Hasn't already hydrated | ||
| appLifecycle === getAppState('STARTED') | ||
| ) { | ||
| let errorLoading = false; | ||
| let error = false; | ||
| try { | ||
| dispatch(hydrateInitialOutputs()); | ||
| } catch (err) { | ||
| errorLoading = true; | ||
| error = true; | ||
| } finally { | ||
| this.setState(state => | ||
| state.errorLoading !== errorLoading ? {errorLoading} : null | ||
| ); | ||
| setErrorLoading(error); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| render() { | ||
| const { | ||
| appLifecycle, | ||
| dependenciesRequest, | ||
| layoutRequest, | ||
| layout, | ||
| config, | ||
| } = this.props; | ||
| const {errorLoading} = this.state; | ||
| const { | ||
| appLifecycle, | ||
| dependenciesRequest, | ||
| layoutRequest, | ||
| layout, | ||
| config, | ||
| } = props; | ||
| if ( | ||
| layoutRequest.status && | ||
| !includes(layoutRequest.status, [STATUS.OK, 'loading']) | ||
| ) { | ||
| return <div className="_dash-error">Error loading layout</div>; | ||
| } else if ( | ||
| errorLoading || | ||
| (dependenciesRequest.status && | ||
| !includes(dependenciesRequest.status, [STATUS.OK, 'loading'])) | ||
| ) { | ||
| return ( | ||
| <div className="_dash-error">Error loading dependencies</div> | ||
| ); | ||
| } else if ( | ||
| appLifecycle === getAppState('HYDRATED') && | ||
| config.ui === true | ||
| ) { | ||
| return ( | ||
| <GlobalErrorContainer> | ||
| <TreeContainer | ||
| _dashprivate_layout={layout} | ||
| _dashprivate_path={[]} | ||
| /> | ||
| </GlobalErrorContainer> | ||
| ); | ||
| } else if (appLifecycle === getAppState('HYDRATED')) { | ||
| return ( | ||
| if ( | ||
| layoutRequest.status && | ||
| !includes(layoutRequest.status, [STATUS.OK, 'loading']) | ||
| ) { | ||
| return <div className="_dash-error">Error loading layout</div>; | ||
| } else if ( | ||
| errorLoading || | ||
| (dependenciesRequest.status && | ||
| !includes(dependenciesRequest.status, [STATUS.OK, 'loading'])) | ||
| ) { | ||
| return <div className="_dash-error">Error loading dependencies</div>; | ||
| } else if (appLifecycle === getAppState('HYDRATED') && config.ui === true) { | ||
| return ( | ||
| <GlobalErrorContainer> | ||
| <TreeContainer | ||
| _dashprivate_layout={layout} | ||
| _dashprivate_path={[]} | ||
| /> | ||
| ); | ||
| } | ||
| return <div className="_dash-loading">Loading...</div>; | ||
| </GlobalErrorContainer> | ||
| ); | ||
| } else if (appLifecycle === getAppState('HYDRATED')) { | ||
| return ( | ||
| <TreeContainer | ||
| _dashprivate_layout={layout} | ||
| _dashprivate_path={[]} | ||
| /> | ||
| ); | ||
| } | ||
| } | ||
| return <div className="_dash-loading">Loading...</div>; | ||
| }; | ||
| UnconnectedContainer.propTypes = { | ||
| appLifecycle: PropTypes.oneOf([ | ||
| getAppState('STARTED'), | ||
| getAppState('HYDRATED'), | ||
| ]), | ||
| dispatch: PropTypes.func, | ||
| dependenciesRequest: PropTypes.object, | ||
| graphs: PropTypes.object, | ||
| layoutRequest: PropTypes.object, | ||
| layout: PropTypes.object, | ||
| paths: PropTypes.object, | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| /* eslint-disable no-undef,react/no-did-update-set-state,no-magic-numbers */ | ||
| import { | ||
| comparator, | ||
| equals, | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
myObject.hasOwnProperty(...)is fine