Skip to content

Commit

Permalink
DEVPROD-14877: Use status if version was created before `displaySta…
Browse files Browse the repository at this point in the history
…tusCache` was added (#657)
  • Loading branch information
minnakt authored Feb 26, 2025
1 parent a89d41c commit ebbe17d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
23 changes: 19 additions & 4 deletions apps/spruce/src/pages/waterfall/BuildRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import VisibilityContainer from "components/VisibilityContainer";
import { getTaskRoute, getVariantHistoryRoute } from "constants/routes";
import { useDimensions } from "hooks/useDimensions";
import { useBuildVariantContext } from "./BuildVariantContext";
import { walkthroughSteps, waterfallGuideId } from "./constants";
import {
walkthroughSteps,
waterfallGuideId,
displayStatusCacheAddedDate,
} from "./constants";
import {
BuildVariantTitle,
columnBasis,
Expand Down Expand Up @@ -133,6 +137,8 @@ export const BuildRow: React.FC<Props> = ({
Builds are sorted in descending revision order and so match the versions' sort order. */
if (version && version.id === builds?.[buildIndex]?.version) {
const b = builds[buildIndex];
const useCachedStatus =
new Date(version.createTime) > displayStatusCacheAddedDate;
buildIndex += 1;
return (
<BuildGrid
Expand All @@ -141,6 +147,7 @@ export const BuildRow: React.FC<Props> = ({
firstActiveTaskId={firstActiveTaskId}
handleTaskClick={handleTaskClick}
isRightmostBuild={b.version === lastActiveVersionId}
useCachedStatus={useCachedStatus}
/>
);
}
Expand All @@ -156,7 +163,14 @@ const BuildGrid: React.FC<{
firstActiveTaskId: string;
handleTaskClick: (s: string) => () => void;
isRightmostBuild: boolean;
}> = ({ build, firstActiveTaskId, handleTaskClick, isRightmostBuild }) => {
useCachedStatus: boolean;
}> = ({
build,
firstActiveTaskId,
handleTaskClick,
isRightmostBuild,
useCachedStatus,
}) => {
const rowRef = useRef<HTMLDivElement>(null);
const { width } = useDimensions<HTMLDivElement>(rowRef);

Expand All @@ -182,8 +196,9 @@ const BuildGrid: React.FC<{
id === firstActiveTaskId
? { [waterfallGuideId]: walkthroughSteps[0].targetId }
: {};
// Use status as backup for tasks created before displayStatusCache was introduced
const taskStatus = (displayStatusCache || status) as TaskStatus;
const taskStatus = (
useCachedStatus ? displayStatusCache : status
) as TaskStatus;
return (
<SquareMemo
key={id}
Expand Down
9 changes: 9 additions & 0 deletions apps/spruce/src/pages/waterfall/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ export const tupleSelectOptions = [
validator: () => true,
},
];

/**
* Timestamp of the last deploy that made changes to `displayStatusCache`, in UTC.
* This timestamp should correspond to 2025/01/21 10:05AM EST.
* TODO: Remove in DEVPROD-15269.
*/
export const displayStatusCacheAddedDate = new Date(
Date.UTC(2025, 0, 21, 15, 5),
);

0 comments on commit ebbe17d

Please sign in to comment.