Skip to content

DEVPROD-18977: Remove repo redirect and introduce useQueryCompleted#1337

Open
minnakt wants to merge 2 commits intoevergreen-ci:mainfrom
minnakt:DEVPROD-18977
Open

DEVPROD-18977: Remove repo redirect and introduce useQueryCompleted#1337
minnakt wants to merge 2 commits intoevergreen-ci:mainfrom
minnakt:DEVPROD-18977

Conversation

@minnakt
Copy link
Contributor

@minnakt minnakt commented Feb 3, 2026

DEVPROD-18977

Description

  • Remove repo redirect. I feel comfortable removing this because data for the biggest repos indicates that no one has navigated to them via the /project route in the past month (Honeycomb link)
  • Clean up the useProjectRedirect hook
  • Add useCompletedQuery hook to handle onCompleted use cases that we lost after Apollo deprecation

Testing

  • Tested on staging

@minnakt minnakt added spruce lib Updates to the @evg-ui/lib package labels Feb 3, 2026
@minnakt minnakt changed the title DEVPROD-18977: Remove repo redirect and introduce useCompletedQuery DEVPROD-18977: Remove repo redirect and introduce useQueryCompleted Feb 3, 2026
@minnakt minnakt marked this pull request as ready for review February 3, 2026 19:31
@minnakt minnakt requested a review from a team as a code owner February 3, 2026 19:31
Comment on lines +46 to 50
useQueryCompleted(loading, () => {
if (columnData && !columnData.taskNamesForBuildVariant) {
reportError(new Error("No task names found for build variant")).warning();
dispatchToast.error(`No tasks found for build variant: ${variantName}}`);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The useQueryCompleted hook doesn't reset its state on variant change, preventing error toasts from showing when navigating to a variant with cached but empty data.
Severity: MEDIUM

Suggested Fix

The useQueryCompleted hook should be modified to accept a dependency array. This array should include variables like projectIdentifier and variantName to ensure the hook's internal state is reset whenever the query's key variables change, not just when the loading state transitions.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: apps/spruce/src/pages/variantHistory/ColumnHeaders.tsx#L46-L50

Potential issue: The `useQueryCompleted` hook in `ColumnHeaders.tsx` fails to show an
error toast when a user navigates from one variant to another. If Apollo Client serves
the data for the new variant from its cache without changing the `loading` state, the
hook's internal completion flag is not reset. This prevents the error callback from
executing, even if the cached data indicates an error (e.g., is empty). This behavior is
a regression from the previous implementation, which explicitly reset the error state
when the variant changed.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib Updates to the @evg-ui/lib package spruce

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant