Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(plan): focus deploy phase on refresh once a rollout exists (#20753)
boojackdfaef54a5359
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.test.tsx b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.test.tsxindex a905674650..89895c25fb 100644--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.test.tsx+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.test.tsx@@ -217,7 +217,7 @@ describe("usePlanDetailPage", () => {expect(result.current.activePhases.has("deploy")).toBe(false);});- test("defaults to only the changes phase on the specs route for rollout plans", async () => {+ test("focuses the deploy phase on the specs route for rollout plans", async () => {mocks.fetchPlanSnapshot.mockResolvedValue(buildSnapshotPatch({planId: "plan-1",@@ -240,12 +240,12 @@ describe("usePlanDetailPage", () => {);await waitFor(() => expect(result.current.ready).toBe(true));- expect(result.current.activePhases.has("changes")).toBe(true);+ expect(result.current.activePhases.has("changes")).toBe(false);expect(result.current.activePhases.has("review")).toBe(false);- expect(result.current.activePhases.has("deploy")).toBe(false);+ expect(result.current.activePhases.has("deploy")).toBe(true);});- test("keeps changes and review on the spec-detail route for reviewed rollout plans", async () => {+ test("focuses the deploy phase on the spec-detail route for reviewed rollout plans", async () => {mocks.fetchPlanSnapshot.mockResolvedValue(buildSnapshotPatch({issue: {@@ -272,9 +272,9 @@ describe("usePlanDetailPage", () => {);await waitFor(() => expect(result.current.ready).toBe(true));- expect(result.current.activePhases.has("changes")).toBe(true);- expect(result.current.activePhases.has("review")).toBe(true);- expect(result.current.activePhases.has("deploy")).toBe(false);+ expect(result.current.activePhases.has("changes")).toBe(false);+ expect(result.current.activePhases.has("review")).toBe(false);+ expect(result.current.activePhases.has("deploy")).toBe(true);});test("has review default phases on the first ready render", async () => {diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.tsindex dce3084931..a35c275416 100644--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts@@ -12,8 +12,6 @@ import {PLAN_DETAIL_PHASE_CHANGES,PLAN_DETAIL_PHASE_DEPLOY,PLAN_DETAIL_PHASE_REVIEW,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,} from "@/react/router/handles";import { State } from "@/types/proto-es/v1/common_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";@@ -81,17 +79,18 @@ const getDefaultActivePhases = (phase: PlanDetailPhase): PlanDetailPhase[] => {};type PhaseSelection = {- routeName?: string;routePhase?: PlanDetailPhase;routeStageId?: string;routeTaskId?: string;};+// The phase to focus by default: an explicit URL selection (phase / stage /+// task) wins, otherwise the furthest-progressed phase the plan has reached.const getCurrentPhase = (snapshot: PlanDetailPageSnapshot,selection: PhaseSelection): PlanDetailPhase => {- const { routeName, routePhase, routeStageId, routeTaskId } = selection;+ const { routePhase, routeStageId, routeTaskId } = selection;if (routePhase === PLAN_DETAIL_PHASE_CHANGES ||routePhase === PLAN_DETAIL_PHASE_REVIEW ||@@ -102,17 +101,6 @@ const getCurrentPhase = (if (routeStageId || routeTaskId) {return PLAN_DETAIL_PHASE_DEPLOY;}- // An explicit specs / spec-detail route always defaults to the spec section,- // even once the plan has a rollout, so shared/bookmarked spec links stay- // usable. A plan under review additionally expands the review section.- if (- routeName === PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS ||- routeName === PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL- ) {- return snapshot.issue- ? PLAN_DETAIL_PHASE_REVIEW- : PLAN_DETAIL_PHASE_CHANGES;- }if (snapshot.rollout) {return PLAN_DETAIL_PHASE_DEPLOY;}@@ -165,7 +153,6 @@ export const usePlanDetailPage = ({const pageIdentityKey = `${projectId}/${planId}`;const phaseSelectionRef = useRef<PhaseSelection>({});phaseSelectionRef.current = {- routeName,routePhase,routeStageId,routeTaskId,@@ -270,7 +257,6 @@ export const usePlanDetailPage = ({syncDefaultActivePhases(latestSnapshotRef.current);}, [pageIdentityKey,- routeName,routePhase,routeStageId,routeTaskId,