浏览代码

make sure we don't render tabs until get app call completes (#3199)

Feroze Mohideen 2 年之前
父节点
当前提交
0271b96533
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      dashboard/src/main/home/app-dashboard/expanded-app/ExpandedApp.tsx

+ 6 - 5
dashboard/src/main/home/app-dashboard/expanded-app/ExpandedApp.tsx

@@ -100,7 +100,6 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
   );
 
   const [saveValuesStatus, setSaveValueStatus] = useState<string>("");
-  const [loading, setLoading] = useState<boolean>(false);
   const [bannerLoading, setBannerLoading] = useState<boolean>(false);
 
   const [showRevisions, setShowRevisions] = useState<boolean>(false);
@@ -153,6 +152,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
   // this method fetches and reconstructs the porter yaml as well as the DB info (stored in PorterApp)
   const getPorterApp = async () => {
     setBannerLoading(true);
+    setIsLoading(true);
     const { appName } = props.match.params as any;
     try {
       if (!currentCluster || !currentProject) {
@@ -532,6 +532,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
 
   const getChartData = async (chart: ChartType, isCurrent?: boolean) => {
     setButtonStatus("");
+    setIsLoading(true);
     try {
       const res = await api.getChart(
         "<token>",
@@ -595,7 +596,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
     } catch (err) {
       console.log(err);
     } finally {
-      setLoading(false);
+      setIsLoading(false);
     }
 
   };
@@ -825,8 +826,8 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
 
   return (
     <>
-      {isLoading && !appData && <Loading />}
-      {!appData && !isLoading && (
+      {isLoading && appData == null && <Loading />}
+      {!isLoading && appData == null && (
         <Placeholder>
           <Container row>
             <PlaceholderIcon src={notFound} />
@@ -839,7 +840,7 @@ const ExpandedApp: React.FC<Props> = ({ ...props }) => {
           <Link to="/apps">Return to dashboard</Link>
         </Placeholder>
       )}
-      {appData && appData.app && (
+      {!isLoading && appData != null && appData.app != null && (
         <StyledExpandedApp>
           <Back to="/apps" />
           <Container row>