Course lesson 10 · Building in a Mono Repo
Create all TRPC CRUD operations
The remaining demonstrated link-management operations replace placeholder results with real shared queries. The application lists an account’s links, loads one link, updates its name, and changes its default and country-specific destinations. TanStack Query invalidation refreshes the affected server data after a successful mutation, keeping the UI synchronized with the database.
Primary source: course video 10 · Supplied English subtitles · 00:24:54.
Understand the idea
- A reusable list query accepts an account and an optional time cursor, selects link fields, orders results, and limits the returned page.
- The link-detail query parses stored destinations into the shared link shape used by the client.
- Destination configuration always includes a default URL and can additionally map country codes to alternate URLs.
- Shared Zod schemas validate sensitive updates before the query writes them, while TypeScript supports callers during development.
- tRPC mutations are network requests despite their function-call-like interface; successful mutation callbacks can invalidate query-cache entries.
What the course does
- Add the get-links query to Data Ops, rebuild it, and replace the list procedure’s dummy array.
- Connect the link-detail page to a real get-link query and return a not-found error for missing links.
- Wire the name editor to the update-name mutation and confirm changes persist after reloading.
- Wire default and country destination edits to the shared update-destinations query.
- Add two country overrides, verify their persistence, then inspect how disabling geo-routing writes only the default destination.
- Observe the follow-up read request triggered by query invalidation after an update succeeds.
Watch for
- Despite its title, the lesson demonstrates create/read/update and deletion of country overrides; it does not implement a separate delete-link operation.
- The narration calls the cursor created-before while describing a greater-than condition. Added advice: verify comparator, ordering, and timestamp boundaries against the actual code before relying on pagination.
- Added advice: account ownership checks are essential when completing authentication; knowing a link ID must not itself authorize edits.
Recall before revealing
Why does a new get-link request appear immediately after the destination update succeeds?
Reveal the explanation
The success handler invalidates that query’s cached data, causing the displayed server data to be fetched again.
Try it
Change a name, add a country override, and disable geo-routing while inspecting network requests and database state.
Check your result
The name persists, the override appears then is removed, the default remains, and you can explain the refresh request after each affected mutation.
Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.
Rewatch only what you need
Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.
- 00:02:00 — List query and time-based pagination
- 00:09:01 — Link-detail and update queries
- 00:11:00 — Destination shape and runtime parsing
- 00:21:01 — Persist and remove country overrides
- 00:23:01 — Invalidate queries after mutation success
Companion primary documentation: tRPC introduction. For recorded API names, commands, limits, and prices, check the version you use.