Skip to content

Commit 4694a78

Browse files
committed
docs: remove optimistic mutations references after write operations removal
1 parent 38afd84 commit 4694a78

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ These rules apply to all coding sessions in the GitPulse project.
66

77
GitPulse is a GitHub Activity Dashboard built with React + TanStack DB. It showcases
88
TanStack DB's realtime features: collections, live queries (filters, joins, sorts,
9-
aggregates), optimistic mutations, and reactive UI updates.
9+
aggregates), and reactive UI updates.
1010

1111
## Architecture
1212

1313
- **Data layer**: TanStack DB collections are the single source of truth
1414
- **Fetching**: TanStack Query + @tanstack/query-db-collection bridges API data into collections
1515
- **Queries**: All UI reads go through `useLiveQuery` / `useLiveSuspenseQuery` — never read from Query cache directly
16-
- **Mutations**: Use `createOptimisticAction` for complex multi-collection mutations, `collection.update()` for simple ones
1716
- **Routing**: Simple state-based SPA page switching (no URL router)
1817

1918
## Code Conventions
@@ -33,13 +32,6 @@ aggregates), optimistic mutations, and reactive UI updates.
3332
- Always pass reactive dependencies as the second argument to `useLiveQuery`
3433
- Use `useLiveSuspenseQuery` inside Suspense boundaries for initial loads only
3534

36-
### Mutations
37-
38-
- Place optimistic actions in `src/mutations/`
39-
- Always call `collection.utils.refetch()` inside `mutationFn` after API call
40-
- Keep `onMutate` synchronous — never await inside it
41-
- Handle rollback by relying on TanStack DB's automatic rollback on error
42-
4335
### API Layer
4436

4537
- All GitHub API functions go in `src/api/`
@@ -74,7 +66,6 @@ aggregates), optimistic mutations, and reactive UI updates.
7466
- `src/collections/` — TanStack DB collection definitions
7567
- `src/schemas/` — Zod schemas for all entities
7668
- `src/queries/` — Reusable live query definitions
77-
- `src/mutations/` — Optimistic action definitions
7869
- `src/api/` — GitHub REST API client and endpoint functions
7970
- `src/pages/` — Top-level page components
8071
- `src/components/` — UI components organized by feature
@@ -96,5 +87,4 @@ Key packages (do not add alternatives without reason):
9687

9788
- Run `npm run build` to verify TypeScript compilation
9889
- Run `npm run dev` to test locally
99-
- Verify optimistic mutations show instant UI feedback before API round-trip
10090
- Test with invalid/expired token to verify error handling

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ queryCollectionOptions() bridge
2727
TanStack DB Collections (single source of truth)
2828
2929
useLiveQuery() (reactive reads in components)
30-
31-
createOptimisticAction() (writes → API → refetch)
3230
```
3331

3432
The key principle: **all UI reads go through TanStack DB live queries, never directly from the Query cache.**
@@ -42,7 +40,6 @@ The key principle: **all UI reads go through TanStack DB live queries, never dir
4240
| `src/schemas/` | Zod schemas for all entities (Repository, Issue, PullRequest, Event, Label, User) |
4341
| `src/collections/` | TanStack DB collection definitions - one per entity, bridged via `queryCollectionOptions()` |
4442
| `src/api/` | GitHub REST API client (`client.ts` handles auth, rate limiting, errors) + endpoint modules |
45-
| `src/mutations/` | Optimistic actions using `createOptimisticAction()` for instant UI updates |
4643
| `src/pages/` | 6 pages: Setup, Dashboard, ActivityFeed, Issues, PullRequests, Contributors |
4744
| `src/components/` | Layout (AppShell, Sidebar, Header) + UI primitives (Button, Card, Badge, Avatar, etc.) |
4845
| `src/hooks/` | `useGitHubToken`, `useTrackedRepos`, `useDarkMode` |
@@ -52,14 +49,12 @@ The key principle: **all UI reads go through TanStack DB live queries, never dir
5249

5350
### Key Patterns
5451

55-
1. **Optimistic mutations** - Every write (`onMutate`) instantly updates the local collection, then the API call fires, then `collection.utils.refetch()` syncs. TanStack DB auto-rolls back on errors.
56-
57-
2. **Resilient multi-repo fetching** - All `fetchAll*()` functions use `Promise.allSettled` so one repo's failure doesn't break others.
52+
1. **Resilient multi-repo fetching** - All `fetchAll*()` functions use `Promise.allSettled` so one repo's failure doesn't break others.
5853

59-
3. **Live queries with reactive deps** - Filters, sorts, and search terms are passed as the second argument to `useLiveQuery`, making the UI automatically re-render when state changes.
54+
2. **Live queries with reactive deps** - Filters, sorts, and search terms are passed as the second argument to `useLiveQuery`, making the UI automatically re-render when state changes.
6055

61-
4. **Simple SPA routing** - A `useState<Page>` in `App.tsx` drives navigation, no URL router.
56+
3. **Simple SPA routing** - A `useState<Page>` in `App.tsx` drives navigation, no URL router.
6257

63-
5. **Stale time strategy** - Labels (10min) > Repos (5min) > Issues/PRs (3min) > Events (2min), reflecting how often each entity changes.
58+
4. **Stale time strategy** - Labels (10min) > Repos (5min) > Issues/PRs (3min) > Events (2min), reflecting how often each entity changes.
6459

65-
6. **Theming** - CSS custom properties in `globals.css` with a `.dark` class override and Tailwind's `dark:` variant. The design is intentionally monochromatic (black/white).
60+
5. **Theming** - CSS custom properties in `globals.css` with a `.dark` class override and Tailwind's `dark:` variant. The design is intentionally monochromatic (black/white).

0 commit comments

Comments
 (0)