Skip to content

Commit

Permalink
fix erroneous timeout message bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Sep 20, 2024
1 parent 8688b21 commit 78830e0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const MUST_LOAD: ResourceName[] = [
];

export class RawApp extends React.Component<AppProps, {}> {
private _isMounted = false;
private get isLoaded() {
return (MUST_LOAD.length ===
intersection(this.props.loaded, MUST_LOAD).length);
Expand All @@ -156,8 +157,9 @@ export class RawApp extends React.Component<AppProps, {}> {
* access into the app, but still warned.
*/
componentDidMount() {
this._isMounted = true;
setTimeout(() => {
if (!this.isLoaded) {
if (this._isMounted && !this.isLoaded) {
error(t(Content.APP_LOAD_TIMEOUT_MESSAGE), { title: t("Warning") });
}
}, LOAD_TIME_FAILURE_MS);
Expand All @@ -166,6 +168,10 @@ export class RawApp extends React.Component<AppProps, {}> {
warning(t(Content.UNSUPPORTED_BROWSER));
}

componentWillUnmount() {
this._isMounted = false;
}

render() {
const syncLoaded = this.isLoaded;
const { bot, dispatch, getConfigValue } = this.props;
Expand Down

0 comments on commit 78830e0

Please sign in to comment.