diff --git a/web/src/features/AppConfig/components/AppConfig.tsx b/web/src/features/AppConfig/components/AppConfig.tsx index e9214d58f2..ff9057648d 100644 --- a/web/src/features/AppConfig/components/AppConfig.tsx +++ b/web/src/features/AppConfig/components/AppConfig.tsx @@ -141,8 +141,10 @@ class AppConfig extends Component { } window.addEventListener("resize", this.determineSidebarHeight); - if (!this.props.app) { - this.getApp(); + if (!app) { + this.fetchApp(); + } else { + this.setState({ app }); } this.getConfig(); } @@ -204,11 +206,7 @@ class AppConfig extends Component { } }; - getApp = async () => { - if (this.props.app) { - return; - } - + fetchApp = async (): Promise => { try { const { slug } = this.props.params; const res = await fetch(`${process.env.API_ENDPOINT}/app/${slug}`, { @@ -221,6 +219,7 @@ class AppConfig extends Component { if (res.ok && res.status == 200) { const app = await res.json(); this.setState({ app }); + return app; } } catch (err) { console.log(err); @@ -416,7 +415,8 @@ class AppConfig extends Component { } if (fromLicenseFlow) { - const hasPreflight = this.props.app.hasPreflight; + const app = await this.fetchApp(); + const hasPreflight = app?.hasPreflight; if (hasPreflight) { navigate(`/${slug}/preflight`, { replace: true }); @@ -661,6 +661,7 @@ class AppConfig extends Component { render() { const { + app, changed, showConfigError, configErrorMessage, @@ -675,7 +676,6 @@ class AppConfig extends Component { showValidationError, } = this.state; const { fromLicenseFlow, params, isHelmManaged } = this.props; - const app = this.props.app; if (configLoading || !app) { return (