Skip to content

Fix prefetch failure on affinity group list#3279

Merged
david-crespo merged 1 commit into
mainfrom
fix-affinity-prefetch
Jul 3, 2026
Merged

Fix prefetch failure on affinity group list#3279
david-crespo merged 1 commit into
mainfrom
fix-affinity-prefetch

Conversation

@david-crespo

@david-crespo david-crespo commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

#2616 (comment)

https://oxide.sys.rack2.eng.oxide.computer/projects/product-assurance/affinity fails on prefetch invariant violation because there are 6 affinity groups, and I had the brilliant idea to only await the prefetch on the instance list for each group if there are less than 6 groups. The conditional await meant the query had to be a useQuery to not blow up when it doesn't await. It was a useQuery originally but, incredibly, it had a TODO: break me! comment on it:

// TODO: Use the prefetched query
export const AffinityGroupMembersCell = ({
antiAffinityGroup,
}: {
antiAffinityGroup: string
}) => {
const { project } = useProjectSelector()
const { data: members } = useQuery(memberList({ antiAffinityGroup, project }))

So eventually we did in fact break it. The conditional logic in the loader is silly, so here we just drop it and put a correct comment on the useQuery (which is still needed because we are prefetching those calls but not awaiting them). And because we don't have the conditional, switching to a usePrefetchedQuery will now blow up the tests immediately regardless of the number of groups on the page.

The effect on the user is that the instance counts here will always have a loading skeleton, even when there are only a few groups. But that's completely fine.

Screenshot 2026-07-03 at 8 01 14 AM

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
console Ready Ready Preview Jul 3, 2026 12:59pm

Request Review

@david-crespo david-crespo merged commit 48cb034 into main Jul 3, 2026
7 checks passed
@david-crespo david-crespo deleted the fix-affinity-prefetch branch July 3, 2026 13:42
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Jul 4, 2026
oxidecomputer/console@f1ccb16...975bba9

* [975bba9f](oxidecomputer/console@975bba9f)
oxidecomputer/console#3280
* [48cb0342](oxidecomputer/console@48cb0342)
oxidecomputer/console#3279
* [3f3931b9](oxidecomputer/console@3f3931b9)
oxidecomputer/console#3267
* [e52a59d0](oxidecomputer/console@e52a59d0)
oxidecomputer/console#3275
* [981326a0](oxidecomputer/console@981326a0)
oxidecomputer/console#3214
* [3f1e275e](oxidecomputer/console@3f1e275e)
oxidecomputer/console#3274
* [d2c4209d](oxidecomputer/console@d2c4209d)
oxidecomputer/console#3272
* [07daaf17](oxidecomputer/console@07daaf17)
oxidecomputer/console#3269
* [1ba8f179](oxidecomputer/console@1ba8f179)
oxidecomputer/console#3260
* [823e5b2e](oxidecomputer/console@823e5b2e)
oxidecomputer/console#3265
* [0a4aa43e](oxidecomputer/console@0a4aa43e)
oxidecomputer/console#3264
* [40c601a0](oxidecomputer/console@40c601a0)
oxidecomputer/console#3262
* [f3c8b15f](oxidecomputer/console@f3c8b15f)
oxidecomputer/console#3258
* [8a8fd12f](oxidecomputer/console@8a8fd12f)
oxidecomputer/console#3257
* [9b7a7f35](oxidecomputer/console@9b7a7f35)
oxidecomputer/console#3169
* [e1ff2b95](oxidecomputer/console@e1ff2b95)
oxidecomputer/console#3256
* [fd85d2a7](oxidecomputer/console@fd85d2a7)
oxidecomputer/console#3255
* [9858df1b](oxidecomputer/console@9858df1b)
oxidecomputer/console#3252
* [4bb87c61](oxidecomputer/console@4bb87c61)
oxidecomputer/console#3247
* [f95cc0af](oxidecomputer/console@f95cc0af)
oxidecomputer/console#3166
* [5bb10883](oxidecomputer/console@5bb10883)
oxidecomputer/console#3246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant