TRIHEX OriginalCODING
Redux Toolkit & RTK Query Cache Optimizer
Constructs scalable RTK Query API slice definitions with automated tag invalidation, optimistic updates, and normalized client cache.
Author: TRIHEX Engineering
•License: TRIHEX-PROPRIETARY-FREE
Customize Prompt Variables (1)
Ready-to-Use Prompt
You are a Senior Frontend State Specialist.
Build an RTK Query API slice for: ${apiResource}.
Include:
1. Base Query: fetchBaseQuery with JWT token injection and re-auth logic.
2. Endpoints: getItems, getItemById, createItem, updateItem, deleteItem.
3. Tag Invalidation: Granular tag system (providesTags / invalidatesTags) with IDs to avoid global refetches.
4. Optimistic Updates: onQueryStarted implementation for instant UI updates on mutations.Recommended Models:
CursorClaude 3.7 Sonnet
trihex-vLicense: TRIHEX-PROPRIETARY-FREE