Skip to content

Commit

Permalink
Ensure we don't call setState on PromiseCancelledException error
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jan 5, 2019
1 parent 527820d commit 996f135
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Document.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export default class Document extends PureComponent {
return { pdf };
}, this.onLoadSuccess);
} catch (error) {
this.setState({ pdf: false });
this.onLoadError(error);
}
}
Expand Down Expand Up @@ -212,6 +211,8 @@ export default class Document extends PureComponent {
return;
}

this.setState({ pdf: false });

errorOnDev(error);

const { onLoadError } = this.props;
Expand Down
3 changes: 2 additions & 1 deletion src/Outline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class OutlineInternal extends PureComponent {
const outline = await cancellable.promise;
this.setState({ outline }, this.onLoadSuccess);
} catch (error) {
this.setState({ outline: false });
this.onLoadError(error);
}
}
Expand Down Expand Up @@ -98,6 +97,8 @@ export class OutlineInternal extends PureComponent {
return;
}

this.setState({ outline: false });

errorOnDev(error);

const { onLoadError } = this.props;
Expand Down
3 changes: 2 additions & 1 deletion src/Page/AnnotationLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export class AnnotationLayerInternal extends PureComponent {
const annotations = await cancellable.promise;
this.setState({ annotations }, this.onLoadSuccess);
} catch (error) {
this.setState({ annotations: false });
this.onLoadError(error);
}
}
Expand All @@ -74,6 +73,8 @@ export class AnnotationLayerInternal extends PureComponent {
return;
}

this.setState({ annotations: false });

errorOnDev(error);

const { onGetAnnotationsError } = this.props;
Expand Down
3 changes: 2 additions & 1 deletion src/Page/TextLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class TextLayerInternal extends PureComponent {
const { items: textItems } = await cancellable.promise;
this.setState({ textItems }, this.onLoadSuccess);
} catch (error) {
this.setState({ textItems: false });
this.onLoadError(error);
}
}
Expand All @@ -71,6 +70,8 @@ export class TextLayerInternal extends PureComponent {
return;
}

this.setState({ textItems: false });

errorOnDev(error);

const { onGetTextError } = this.props;
Expand Down

0 comments on commit 996f135

Please sign in to comment.