Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 414d7ac

Browse files
author
Michelle Tilley
committed
Add some boundaries for them errors
1 parent 7363495 commit 414d7ac

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/controllers/file-patch-controller.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {autobind} from 'core-decorators';
99

1010
import Switchboard from '../switchboard';
1111
import FilePatchView from '../views/file-patch-view';
12+
import ErrorBoundary from '../views/error-boundary';
1213
import ModelObserver from '../models/model-observer';
1314
import FilePatch from '../models/file-patch';
1415

@@ -171,6 +172,10 @@ export default class FilePatchController extends React.Component {
171172
}
172173

173174
render() {
175+
return <ErrorBoundary>{this.renderDetails()}</ErrorBoundary>;
176+
}
177+
178+
renderDetails() {
174179
const hunks = this.state.filePatch ? this.state.filePatch.getHunks() : [];
175180
const repository = this.repositoryObserver.getActiveModel();
176181
if (repository.isUndetermined() || repository.isLoading()) {

lib/controllers/github-tab-controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import yubikiri from 'yubikiri';
66
import RemotePrController from './remote-pr-controller';
77
import GithubLoginModel from '../models/github-login-model';
88
import ObserveModel from '../views/observe-model';
9+
import ErrorBoundary from '../views/error-boundary';
910
import {RemotePropType} from '../prop-types';
1011

1112
class RemoteSelector extends React.Component {
@@ -70,9 +71,11 @@ export default class GithubTabController extends React.Component {
7071

7172
render() {
7273
return (
73-
<ObserveModel model={this.props.repository} fetchData={this.fetchModelData}>
74-
{data => { return data ? this.renderWithData(data) : null; } }
75-
</ObserveModel>
74+
<ErrorBoundary>
75+
<ObserveModel model={this.props.repository} fetchData={this.fetchModelData}>
76+
{data => { return data ? this.renderWithData(data) : null; } }
77+
</ObserveModel>
78+
</ErrorBoundary>
7679
);
7780
}
7881

0 commit comments

Comments
 (0)