Use key instead
This commit is contained in:
@ -2,12 +2,10 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { observable } from 'mobx';
|
import { observable } from 'mobx';
|
||||||
import type { Location } from 'react-router-dom';
|
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
import PageTitle from 'components/PageTitle';
|
import PageTitle from 'components/PageTitle';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
location?: Location,
|
|
||||||
children?: ?React.Element<any>,
|
children?: ?React.Element<any>,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -16,15 +14,6 @@ class ErrorBoundary extends Component {
|
|||||||
props: Props;
|
props: Props;
|
||||||
@observable error: boolean = false;
|
@observable error: boolean = false;
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: Object) {
|
|
||||||
if (
|
|
||||||
this.props.location &&
|
|
||||||
nextProps.location &&
|
|
||||||
this.props.location.pathname !== nextProps.location.pathname
|
|
||||||
)
|
|
||||||
this.error = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidCatch(error: Error, info: Object) {
|
componentDidCatch(error: Error, info: Object) {
|
||||||
this.error = true;
|
this.error = true;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class DocumentScene extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container column auto>
|
<Container column auto>
|
||||||
<ErrorBoundary location={this.props.location}>
|
<ErrorBoundary key={this.props.location.pathname}>
|
||||||
{isMoving && document && <DocumentMove document={document} />}
|
{isMoving && document && <DocumentMove document={document} />}
|
||||||
{titleText && <PageTitle title={titleText} />}
|
{titleText && <PageTitle title={titleText} />}
|
||||||
{(this.isLoading || this.isSaving) && <LoadingIndicator />}
|
{(this.isLoading || this.isSaving) && <LoadingIndicator />}
|
||||||
|
Reference in New Issue
Block a user