Comfy-Org / Comfy-Org/registry-web
Unban node: cache invalidation uses wrong query key, UI stays stale
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
## What
In `handleUnbanNode` (`components/nodes/NodeDetails.tsx`), the node-detail cache is invalidated with the query key `['/nodes', node.id]`:
```ts
await queryClient.invalidateQueries({ queryKey: ["/nodes", node.id] });
```
But the orval-generated key for `useGetNode` is a single-element array:
```ts
// src/api/generated.ts (getGetNodeQueryKey)
return [`/nodes/${nodeId}`, ...(params ? [params] : [])]; // e.g. ['/nodes/123']
```
React Query matches query keys by **array prefix, element-by-element**. `['/nodes', '123']` does not prefix-match `['/nodes/123']` (`'/nodes'` ≠ `'/nodes/123'`), so this invalidation never hits the cached node, and the node detail view can remain stale after an unban until a hard refresh.
## Why
Users (admins) unban a node and the status badge / install affordances don't update to reflect the active state until they reload.
## How
Match the generated key. Either use the generated key helper or the correct literal:
```ts
await queryClient.invalidateQueries({ queryKey: getGetNodeQueryKey(node.id) });
// or
await queryClient.invalidateQueries({ queryKey: [`/nodes/${node.id}`] });
```
## Notes
- Pre-existing on `main` (not introduced by any open PR). Surfaced by CodeRabbit while reviewing #272; filing separately to keep that PR scoped to changelog rendering.
- `handleBanNode` / the unban path also invalidate the collection key `['/nodes']`, which is fine; only the specific-node key is wrong.
Contributor guide
No contributing guide indexed for this repository
Research direction
Open components/nodes/NodeDetails.tsx and compare the node-detail invalidation with getGetNodeQueryKey in src/api/generated.ts. Update the specific-node invalidation to match the generated key, then verify that the node detail status and install affordances update after unbanning without a hard refresh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100