Procházet zdrojové kódy

patch/redirect-to-correct-preview-environment-page (#4275)

Co-authored-by: ianedwards <ianedwards559@gmail.com>
Max Chehab před 2 roky
rodič
revize
1289a8790a

+ 2 - 2
dashboard/src/main/home/Home.tsx

@@ -605,10 +605,10 @@ const Home: React.FC<Props> = (props) => {
                       exact
                       path={`/preview-environments/apps/:appName/:tab`}
                     >
-                      <AppView />
+                      <AppView preview />
                     </Route>
                     <Route exact path="/preview-environments/apps/:appName">
-                      <AppView />
+                      <AppView preview />
                     </Route>
                     <Route exact path={`/preview-environments/apps`}>
                       <Apps />

+ 3 - 3
dashboard/src/main/home/app-dashboard/app-view/AppView.tsx

@@ -28,9 +28,9 @@ export const porterAppValidator = z.object({
 });
 export type PorterAppRecord = z.infer<typeof porterAppValidator>;
 
-type Props = RouteComponentProps;
+type Props = RouteComponentProps & { preview?: boolean };
 
-const AppView: React.FC<Props> = ({ match }) => {
+const AppView: React.FC<Props> = ({ match, preview }) => {
   const params = useMemo(() => {
     const { params } = match;
     const validParams = z
@@ -53,7 +53,7 @@ const AppView: React.FC<Props> = ({ match }) => {
   return (
     <LatestRevisionProvider appName={params.appName}>
       <StyledExpandedApp>
-        <Back to="/apps" />
+        <Back to={preview ? "/preview-environments" : "/apps"} />
         <AppHeader />
         <AppDataContainer tabParam={params.tab} />
       </StyledExpandedApp>