feat: add ErrorBoundary to chart controls (#13584)

This commit is contained in:
Jesse Yang 2021-03-15 14:44:18 -07:00 committed by GitHub
parent 714d262336
commit 868e063b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -19,6 +19,7 @@
import React, { ReactNode } from 'react';
import { ControlType } from '@superset-ui/chart-controls';
import { JsonValue, QueryFormData } from '@superset-ui/core';
import ErrorBoundary from 'src/components/ErrorBoundary';
import { ExploreActions } from 'src/explore/actions/exploreActions';
import controlMap from './controls';
@ -78,11 +79,13 @@ export default class Control extends React.PureComponent<
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}
>
<ControlComponent
onChange={this.onChange}
hovered={this.state.hovered}
{...this.props}
/>
<ErrorBoundary>
<ControlComponent
onChange={this.onChange}
hovered={this.state.hovered}
{...this.props}
/>
</ErrorBoundary>
</div>
);
}

View File

@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { sharedControlComponents } from '@superset-ui/chart-controls';
import AnnotationLayerControl from './AnnotationLayerControl';
import BoundsControl from './BoundsControl';
import CheckboxControl from './CheckboxControl';
@ -73,5 +74,6 @@ const controlMap = {
MetricsControl,
AdhocFilterControl,
FilterBoxItemControl,
...sharedControlComponents,
};
export default controlMap;