diff options
Diffstat (limited to 'packages/website/ts/pages/documentation')
-rw-r--r-- | packages/website/ts/pages/documentation/documentation.tsx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/packages/website/ts/pages/documentation/documentation.tsx b/packages/website/ts/pages/documentation/documentation.tsx index 13a85c301..a5ecd9e1c 100644 --- a/packages/website/ts/pages/documentation/documentation.tsx +++ b/packages/website/ts/pages/documentation/documentation.tsx @@ -78,8 +78,10 @@ const styles: Styles = { }; export class Documentation extends React.Component<DocumentationAllProps, DocumentationState> { + 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<DocumentationAllProps, Docume // tslint:disable-next-line:no-floating-promises this._fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists); } + public componentWillUnmount() { + this._isUnmounted = true; + } public render() { const menuSubsectionsBySection = _.isUndefined(this.state.docAgnosticFormat) ? {} @@ -367,13 +372,15 @@ export class Documentation extends React.Component<DocumentationAllProps, Docume ); const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj as DoxityDocObj); - this.setState( - { - docAgnosticFormat, - }, - () => { - this._scrollToHash(); - }, - ); + if (!this._isUnmounted) { + this.setState( + { + docAgnosticFormat, + }, + () => { + this._scrollToHash(); + }, + ); + } } } |