{
public componentDidMount() {
window.scrollTo(0, 0);
}
+ public componentWillUnmount() {
+ this._isUnmounted = true;
+ }
public render() {
return (
@@ -456,12 +461,14 @@ export class FillOrder extends React.Component {
if (!_.isEmpty(orderJSON)) {
orderJSONErrMsg = 'Submitted order JSON is not valid JSON';
}
- this.setState({
- didOrderValidationRun: true,
- orderJSON,
- orderJSONErrMsg,
- parsedOrder,
- });
+ if (!this._isUnmounted) {
+ this.setState({
+ didOrderValidationRun: true,
+ orderJSON,
+ orderJSONErrMsg,
+ parsedOrder,
+ });
+ }
return;
}
diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx
index 44f3fc4a87..9078f7fe10 100644
--- a/packages/website/ts/components/inputs/token_amount_input.tsx
+++ b/packages/website/ts/components/inputs/token_amount_input.tsx
@@ -30,8 +30,10 @@ interface TokenAmountInputState {
}
export class TokenAmountInput extends React.Component {
+ private _isUnmounted: boolean;
constructor(props: TokenAmountInputProps) {
super(props);
+ this._isUnmounted = false;
const defaultAmount = new BigNumber(0);
this.state = {
balance: defaultAmount,
@@ -43,6 +45,9 @@ export class TokenAmountInput extends React.Component {
+ private _isUnmounted: boolean;
public constructor(props: TokenBalancesProps) {
super(props);
+ this._isUnmounted = false;
const initialTrackedTokenStateByAddress = this._getInitialTrackedTokenStateByAddress(props.trackedTokens);
this.state = {
errorType: undefined,
@@ -109,6 +111,9 @@ export class TokenBalances extends React.Component {
+ private _isUnmounted: boolean;
constructor(props: DocumentationAllProps) {
super(props);
+ this._isUnmounted = false;
this.state = {
docAgnosticFormat: undefined,
};
@@ -92,6 +94,9 @@ export class Documentation extends React.Component {
- this._scrollToHash();
- },
- );
+ if (!this._isUnmounted) {
+ this.setState(
+ {
+ docAgnosticFormat,
+ },
+ () => {
+ this._scrollToHash();
+ },
+ );
+ }
}
}
diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx
index a3cf72450c..daf5c27a7e 100644
--- a/packages/website/ts/pages/wiki/wiki.tsx
+++ b/packages/website/ts/pages/wiki/wiki.tsx
@@ -45,8 +45,10 @@ const styles: Styles = {
export class Wiki extends React.Component {
private _wikiBackoffTimeoutId: number;
+ private _isUnmounted: boolean;
constructor(props: WikiProps) {
super(props);
+ this._isUnmounted = false;
this.state = {
articlesBySection: undefined,
};
@@ -56,6 +58,7 @@ export class Wiki extends React.Component {
this._fetchArticlesBySectionAsync();
}
public componentWillUnmount() {
+ this._isUnmounted = true;
clearTimeout(this._wikiBackoffTimeoutId);
}
public render() {
@@ -179,14 +182,16 @@ export class Wiki extends React.Component {
return;
}
const articlesBySection = await response.json();
- this.setState(
- {
- articlesBySection,
- },
- () => {
- this._scrollToHash();
- },
- );
+ if (!this._isUnmounted) {
+ this.setState(
+ {
+ articlesBySection,
+ },
+ () => {
+ this._scrollToHash();
+ },
+ );
+ }
}
private _getMenuSubsectionsBySection(articlesBySection: ArticlesBySection) {
const sectionNames = _.keys(articlesBySection);