Skip to content

Commit eff4995

Browse files
committed
Update SKILL.md
1 parent 3e0c15d commit eff4995

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

SKILL.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,35 @@ const { data, isLoading, error, refetch } = queryClient.useQuery(
176176
```tsx
177177
const mutation = queryClient.useMutation('post', 'createUser', {
178178
onSuccess: (data) => {
179-
tanstackQueryClient.invalidateQueries({ queryKey: ['get', 'getUsers'] })
179+
client.invalidateQueries({
180+
queryKey: queryClient.getQueryKey('get', 'getUsers'),
181+
})
180182
}
181183
})
182184

183185
mutation.mutate({ body: { name: 'John', email: 'john@example.com' } })
184186
```
185187

188+
### getQueryKey (Cache Invalidation)
189+
190+
Use `queryClient.getQueryKey()` to get type-safe query keys for cache invalidation:
191+
192+
```tsx
193+
// By operationId
194+
queryClient.getQueryKey('get', 'getUsers')
195+
196+
// By path with params
197+
queryClient.getQueryKey('get', '/users/{id}', { params: { id: '123' } })
198+
199+
// Usage with TanStack Query client
200+
client.invalidateQueries({
201+
queryKey: queryClient.getQueryKey(
202+
'get',
203+
'/project-subject/projects/{projectId}/companion',
204+
),
205+
})
206+
```
207+
186208
### useSuspenseQuery
187209

188210
```tsx

0 commit comments

Comments
 (0)