Repository navigation
refactor: replace useSanity with a TanStack Query layer over Sanity - #301
Open
Tomahawk2191 wants to merge 12 commits into
Open
Tomahawk2191 wants to merge 12 commits into
Tomahawk2191 wants to merge 12 commits into
Conversation
Replace useSanity with queryOptions factories in src/sanity, typed via Sanity TypeGen, sharing one all-copy query, sized image URLs via select, and director image preloading. Update e2e Sanity mock to match query result shapes.
…ia urlFor without fixed widths
…fore projecting zIndex
✅ Deploy Preview for generatenu-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
… sized director images) and absorb image-compression constant
Tomahawk2191
marked this pull request as ready for review
November 14, 2026 20:27
This was referenced Nov 14, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the ticket?
N/A
What did I do?
Part 1 of 5 in the TanStack Query + React Router refactor. Stack: #301 → #302 → #303 → #304 → #305. Review and merge in order.
Replaces the
useSanityhook with a typed TanStack Query layer over Sanity.@tanstack/react-querywith a sharedqueryClient(staleTime: Infinity, since Sanity content doesn't change within a session).defineQueryand result types are generated intosrc/sanity/queries/types.gen.ts(bun run typegen).src/sanity/queries/(copyQuery,directorsQuery,teamsQuery,showcasesQuery,valuesQuery,linksQuery), each exportingqueryOptionswith aselectthat shapes data for the UI.src/services/useSanity.ts,src/client.tsand the page-leveltypes.tsfiles.urlFor, which requestsauto=format,fit=maxand quality 75. Director and showcase images are requested at fixed widths (650px and 1440px) instead of full size.preload()so hovering a character no longer waits on a fresh image fetch.hidden, so each image is fetched and decoded once instead of on every click.@tanstack/eslint-plugin-queryrules in oxlint.How did I test it?
Ran
bun run lint,bun run typecheck,oxfmt --checkandbun run buildon this branch; all pass. e2e and manual browser testing still to do.Required checks:
What could go wrong in the future? What parts of your code should the reviewer pay the most attention to?
types.gen.tsis generated. After changing a GROQ query or the Sanity schema, runbun run typegenor the types will drift.staleTime: Infinitymeans content edited in Sanity only shows up on a full page reload.directorsQuery.tsandshowcasesQuery.tsare tied to the current layouts; if those components grow, bump the widths.Additional Comments for the Reviewers
Supersedes the
isaac/image-compressionbranch.Screenshots
N/A, no visual changes intended.