New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(next/app-dir): contextCache
to control context values to add to cacheTag
#5537
Open
dalechyn
wants to merge
48
commits into
trpc:next
Choose a base branch
from
dalechyn:cache-context
base: next
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
6f32a91
feat(next/app-dir): `cacheTag` generation to consider context
dalechyn 7ee54e8
nit: lint
dalechyn 6cfe7f4
Merge remote-tracking branch 'upstream/next' into next
dalechyn cf3c99f
refactor(next/app-dir): `@noble/hashes` -> `crypto` for input hashing
dalechyn 6989a2e
refactor(next/app-dir): use `crypto.subtle` instead
dalechyn b29441a
feat(next/app-dir): drop http link, add `createContext` param to serv…
dalechyn 655888e
nit: lint
dalechyn dfb02d1
Merge remote-tracking branch 'upstream/next' into next
dalechyn a8e88f1
chore: apply lint and formatting fixes
autofix-ci[bot] 336f480
feat: hoist createContext one level up
dalechyn d133445
Merge remote-tracking branch 'upstream/next' into next
dalechyn 8e35dda
chore: apply lint and formatting fixes
autofix-ci[bot] 726931d
refactor: don't change `AnyClientTypes`
dalechyn 2f5fdff
Merge remote-tracking branch 'upstream/next' into next
dalechyn 2f1baad
hoist
juliusmarminge f305da3
feat: delete `server-http`
dalechyn 129d8f4
test: add regression test for `cacheContext`
dalechyn 75af515
chore: apply lint and formatting fixes
autofix-ci[bot] 0866a5a
fix(server): use the recommended connection handler from @fastify/web…
mat-sz e66cd06
fix(client / server): chained `.pipe()`s in observables (#5533)
KATT c054046
chore: use vitest workspaces (#5461)
juliusmarminge 60976e9
Merge remote-tracking branch 'upstream/next' into cache-context
dalechyn 1dfd889
feat: bring the http back
dalechyn 2d4e0af
chore: apply lint and formatting fixes
autofix-ci[bot] 7348eec
fix: nextHttp tests
dalechyn b80e148
revert unrelated
juliusmarminge 174cd91
rev more
juliusmarminge 64faf05
nice
juliusmarminge aaa7983
chore: apply lint and formatting fixes
autofix-ci[bot] 66ae725
revert some stuff
juliusmarminge f568388
revert more unused
juliusmarminge df05c4e
wtf autolinter
juliusmarminge 6662379
chore: apply lint and formatting fixes
autofix-ci[bot] 0b24086
Merge branch 'next' into cache-context
juliusmarminge 4e0b11a
revv lock
juliusmarminge 68b265b
fuck this autolinter
juliusmarminge 3edaaed
cache context
juliusmarminge c89d7c2
niceee
juliusmarminge 342537a
fix
juliusmarminge bf86986
feat: add proxy callback opts to `contextSelector`
dalechyn a01dfcd
Merge remote-tracking branch 'upstream/next' into cache-context
dalechyn 68429bb
chore: apply lint and formatting fixes
autofix-ci[bot] e38a826
feat: requested changes
dalechyn a51b953
Merge remote-tracking branch 'upstream/next' into cache-context
dalechyn e0dda23
nit: comment
dalechyn 2ab36b7
nit: revert lockfile changes
dalechyn 525f326
nit: initialize client lazily
dalechyn 531717e
Merge branch 'next' into cache-context
dalechyn File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,8 @@ export const api = experimental_createTRPCNextAppDirServer<typeof appRouter>({ | |
return { | ||
createContext: () => createContext('invoke'), | ||
contextSelector: (ctx, callOpts) => { | ||
if (callOpts.path[0] === 'privateGreeting') | ||
return [ctx.session?.user.id, ctx._userIdMock]; | ||
return []; | ||
if (!['privateGreeting'].includes(callOpts.path[0])) return []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a comment would be nice - i don't know if even i would know what this does if i revisit this example in a month or 2 ;) |
||
return [ctx.session?.user.id, ctx._userIdMock]; | ||
}, | ||
links: [ | ||
loggerLink({ | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this example should show a "private by default" and opt-in to sharing cache for specific procedures thst doesnt have sensitive data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thoughts, will implement