Merge pull request #529 from outline/remove-error-boundary
Remove Document error boundary
This commit is contained in:
@@ -32,7 +32,6 @@ import CenteredContent from 'components/CenteredContent';
|
|||||||
import PageTitle from 'components/PageTitle';
|
import PageTitle from 'components/PageTitle';
|
||||||
import NewDocumentIcon from 'components/Icon/NewDocumentIcon';
|
import NewDocumentIcon from 'components/Icon/NewDocumentIcon';
|
||||||
import Actions, { Action, Separator } from 'components/Actions';
|
import Actions, { Action, Separator } from 'components/Actions';
|
||||||
import ErrorBoundary from 'components/ErrorBoundary';
|
|
||||||
import Search from 'scenes/Search';
|
import Search from 'scenes/Search';
|
||||||
|
|
||||||
const DISCARD_CHANGES = `
|
const DISCARD_CHANGES = `
|
||||||
@@ -228,76 +227,74 @@ class DocumentScene extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container column auto>
|
<Container column auto>
|
||||||
<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 />}
|
{!document || !Editor ? (
|
||||||
{!document || !Editor ? (
|
<CenteredContent>
|
||||||
<CenteredContent>
|
<LoadingState />
|
||||||
<LoadingState />
|
</CenteredContent>
|
||||||
</CenteredContent>
|
) : (
|
||||||
) : (
|
<Flex justify="center" auto>
|
||||||
<Flex justify="center" auto>
|
{this.isEditing && (
|
||||||
{this.isEditing && (
|
<Prompt
|
||||||
<Prompt
|
when={document.hasPendingChanges}
|
||||||
when={document.hasPendingChanges}
|
message={DISCARD_CHANGES}
|
||||||
message={DISCARD_CHANGES}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Editor
|
|
||||||
text={document.text}
|
|
||||||
emoji={document.emoji}
|
|
||||||
onImageUploadStart={this.onImageUploadStart}
|
|
||||||
onImageUploadStop={this.onImageUploadStop}
|
|
||||||
onChange={this.onChange}
|
|
||||||
onSave={this.onSave}
|
|
||||||
onCancel={this.onDiscard}
|
|
||||||
readOnly={!this.isEditing}
|
|
||||||
/>
|
/>
|
||||||
<Actions
|
)}
|
||||||
align="center"
|
<Editor
|
||||||
justify="flex-end"
|
text={document.text}
|
||||||
readOnly={!this.isEditing}
|
emoji={document.emoji}
|
||||||
>
|
onImageUploadStart={this.onImageUploadStart}
|
||||||
{!isNew &&
|
onImageUploadStop={this.onImageUploadStop}
|
||||||
!this.isEditing && <Collaborators document={document} />}
|
onChange={this.onChange}
|
||||||
<Action>
|
onSave={this.onSave}
|
||||||
{this.isEditing ? (
|
onCancel={this.onDiscard}
|
||||||
<SaveAction
|
readOnly={!this.isEditing}
|
||||||
isSaving={this.isSaving}
|
/>
|
||||||
onClick={this.onSave.bind(this, true)}
|
<Actions
|
||||||
disabled={
|
align="center"
|
||||||
!(this.document && this.document.allowSave) ||
|
justify="flex-end"
|
||||||
this.isSaving
|
readOnly={!this.isEditing}
|
||||||
}
|
>
|
||||||
isNew={!!isNew}
|
{!isNew &&
|
||||||
/>
|
!this.isEditing && <Collaborators document={document} />}
|
||||||
) : (
|
<Action>
|
||||||
<a onClick={this.onClickEdit}>Edit</a>
|
{this.isEditing ? (
|
||||||
)}
|
<SaveAction
|
||||||
</Action>
|
isSaving={this.isSaving}
|
||||||
{this.isEditing && (
|
onClick={this.onSave.bind(this, true)}
|
||||||
<Action>
|
disabled={
|
||||||
<a onClick={this.onDiscard}>Discard</a>
|
!(this.document && this.document.allowSave) ||
|
||||||
</Action>
|
this.isSaving
|
||||||
|
}
|
||||||
|
isNew={!!isNew}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<a onClick={this.onClickEdit}>Edit</a>
|
||||||
)}
|
)}
|
||||||
|
</Action>
|
||||||
|
{this.isEditing && (
|
||||||
|
<Action>
|
||||||
|
<a onClick={this.onDiscard}>Discard</a>
|
||||||
|
</Action>
|
||||||
|
)}
|
||||||
|
{!this.isEditing && (
|
||||||
|
<Action>
|
||||||
|
<DocumentMenu document={document} />
|
||||||
|
</Action>
|
||||||
|
)}
|
||||||
|
{!this.isEditing && <Separator />}
|
||||||
|
<Action>
|
||||||
{!this.isEditing && (
|
{!this.isEditing && (
|
||||||
<Action>
|
<a onClick={this.onClickNew}>
|
||||||
<DocumentMenu document={document} />
|
<NewDocumentIcon />
|
||||||
</Action>
|
</a>
|
||||||
)}
|
)}
|
||||||
{!this.isEditing && <Separator />}
|
</Action>
|
||||||
<Action>
|
</Actions>
|
||||||
{!this.isEditing && (
|
</Flex>
|
||||||
<a onClick={this.onClickNew}>
|
)}
|
||||||
<NewDocumentIcon />
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</Action>
|
|
||||||
</Actions>
|
|
||||||
</Flex>
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user