Skip to content

Commit

Permalink
nit: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dalechyn committed Feb 7, 2024
1 parent 6f32a91 commit 7ee54e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/next/src/app-dir/links/nextCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export function experimental_nextCacheLink<TRouter extends AnyRouter>(
const promise = opts
.createContext()
.then(async (ctx) => {
const cacheTag = generateCacheTag(path, input, opts.cacheContext?.(ctx));
const cacheTag = generateCacheTag(
path,
input,
opts.cacheContext?.(ctx),
);
// Let per-request revalidate override global revalidate
const requestRevalidate =
typeof context['revalidate'] === 'number' ||
Expand Down
10 changes: 7 additions & 3 deletions packages/next/src/app-dir/shared.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sha256 } from '@noble/hashes/sha256';
import type {
CreateTRPCClientOptions,
Resolver,
Expand All @@ -14,7 +15,6 @@ import type {
RouterRecord,
} from '@trpc/server/unstable-core-do-not-import';
import { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';
import { sha256 } from '@noble/hashes/sha256'

/**
* @internal
Expand Down Expand Up @@ -87,8 +87,12 @@ export interface CreateTRPCNextAppRouterOptions<TRouter extends AnyRouter> {
/**
* @internal
*/
export function generateCacheTag(procedurePath: string, input: any, context?: any) {
return `${procedurePath}?hash=${sha256(JSON.stringify({input, context}))}`
export function generateCacheTag(
procedurePath: string,
input: any,
context?: any,
) {
return `${procedurePath}?hash=${sha256(JSON.stringify({ input, context }))}`;
}

export function isFormData(value: unknown): value is FormData {
Expand Down

0 comments on commit 7ee54e8

Please sign in to comment.