Skip to content

Commit 11a27a4

Browse files
KATTautofix-ci[bot]coderabbitai[bot]
authored
chore: remove overzealous destructuring (#6930)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - None - Documentation - Revised coding guidelines: nuanced destructuring rules and front-matter now include .md/.mdx. - Unified resolver/middleware examples to use a single opts parameter. - Blog example: added tracing middleware and a span meta tag. - Fixed Next.js TypeScript docs link. - Refactor - Standardized example servers and code samples to opts-based callbacks without behavior changes. - Tests - Updated test suites to opts-based handlers; no behavioral changes. - Chores - Added rules enforcing pnpm usage and running tests without watch mode. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent ba8be67 commit 11a27a4

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

src/server/routers/post.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export const postRouter = router({
5858
text: z.string().min(1),
5959
}),
6060
)
61-
.mutation(async ({ input, ctx }) => {
61+
.mutation(async (opts) => {
62+
const { input, ctx } = opts;
6263
const { name } = ctx.user;
6364
const post = await prisma.post.create({
6465
data: {
@@ -75,7 +76,8 @@ export const postRouter = router({
7576

7677
isTyping: authedProcedure
7778
.input(z.object({ typing: z.boolean() }))
78-
.mutation(({ input, ctx }) => {
79+
.mutation((opts) => {
80+
const { input, ctx } = opts;
7981
const { name } = ctx.user;
8082
if (!input.typing) {
8183
delete currentlyTyping[name];
@@ -94,7 +96,8 @@ export const postRouter = router({
9496
take: z.number().min(1).max(50).nullish(),
9597
}),
9698
)
97-
.query(async ({ input }) => {
99+
.query(async (opts) => {
100+
const { input } = opts;
98101
const take = input.take ?? 10;
99102
const cursor = input.cursor;
100103

src/utils/trpc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const trpc = createTRPCNext<AppRouter>({
6262
*/
6363
ssr: true,
6464
ssrPrepass,
65-
config({ ctx }) {
65+
config(config) {
6666
/**
6767
* If you want to use SSR, you need to use the server's full URL
6868
* @see https://trpc.io/docs/v11/ssr
@@ -80,7 +80,7 @@ export const trpc = createTRPCNext<AppRouter>({
8080
typeof window !== 'undefined') ||
8181
(opts.direction === 'down' && opts.result instanceof Error),
8282
}),
83-
getEndingLink(ctx),
83+
getEndingLink(config.ctx),
8484
],
8585
/**
8686
* @see https://tanstack.com/query/v5/docs/reference/QueryClient

0 commit comments

Comments
 (0)