Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"@trpc/react-query": "^11.0.0-rc.446",
"@trpc/server": "^11.0.0-rc.446",
"geist": "^1.3.0",
"next": "^14.2.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"next": "14.2.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"server-only": "^0.0.1",
"superjson": "^2.2.1",
"zod": "^3.23.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'server-only';

import { createHydrationHelpers } from '@trpc/react-query/rsc';
import { headers } from 'next/headers';
import { cache } from 'react';

import { type AppRouter, createCaller } from '~/server/api/root';
import { createTRPCContext } from '~/server/api/trpc';
Expand All @@ -12,16 +11,16 @@ import { createQueryClient } from './query-client';
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a tRPC call from a React Server Component.
*/
const createContext = cache(() => {
const createContext = () => {
const heads = new Headers(headers());
heads.set('x-trpc-source', 'rsc');

return createTRPCContext({
headers: heads,
});
});
};

const getQueryClient = cache(createQueryClient);
const getQueryClient = createQueryClient;
const caller = createCaller(createContext);

export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>(caller, getQueryClient);
8 changes: 0 additions & 8 deletions packages/nextjs/src/common/captureRequestError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC
});
});
}

/**
* Reports errors passed to the the Next.js `onRequestError` instrumentation hook.
*
* @deprecated Use `captureRequestError` instead.
*/
// TODO(v9): Remove this export
export const experimental_captureRequestError = captureRequestError;
3 changes: 1 addition & 2 deletions packages/nextjs/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export { wrapMiddlewareWithSentry } from './wrapMiddlewareWithSentry';
export { wrapPageComponentWithSentry } from './pages-router-instrumentation/wrapPageComponentWithSentry';
export { wrapGenerationFunctionWithSentry } from './wrapGenerationFunctionWithSentry';
export { withServerActionInstrumentation } from './withServerActionInstrumentation';
// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './captureRequestError';
export { captureRequestError } from './captureRequestError';
3 changes: 1 addition & 2 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@ export declare function wrapApiHandlerWithSentryVercelCrons<F extends (...args:
*/
export declare function wrapPageComponentWithSentry<C>(WrappingTarget: C): C;

// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './common/captureRequestError';
export { captureRequestError } from './common/captureRequestError';
Loading