Skip to content

Commit f6ff082

Browse files
committed
pass parameterized route to wrapper functions
1 parent 1e93746 commit f6ff082

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

packages/nextjs/src/config/templates/dataFetchersLoaderTemplate.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ const PARAMETERIZED_ROUTE = '__FILEPATH__';
2121

2222
export const getServerSideProps =
2323
typeof __ORIG_GSSP__ === 'function'
24-
? ServerSideSentryNextjsSDK.withSentryGetServerSideProps(__ORIG_GSSP__)
24+
? ServerSideSentryNextjsSDK.withSentryGetServerSideProps(__ORIG_GSSP__, PARAMETERIZED_ROUTE)
2525
: __ORIG_GSSP__;
26+
2627
export const getStaticProps =
2728
typeof __ORIG_GSPROPS__ === 'function'
28-
? ServerSideSentryNextjsSDK.withSentryGetStaticProps(__ORIG_GSPROPS__)
29+
? ServerSideSentryNextjsSDK.withSentryGetStaticProps(__ORIG_GSPROPS__, PARAMETERIZED_ROUTE)
2930
: __ORIG_GSPROPS__;

packages/nextjs/src/config/wrappers/withSentryGetServerSideProps.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { callOriginal } from './wrapperUtils';
55
* Create a wrapped version of the user's exported `getServerSideProps` function
66
*
77
* @param origGetServerSideProps: The user's `getServerSideProps` function
8+
* @param route: The page's parameterized route
89
* @returns A wrapped version of the function
910
*/
10-
export function withSentryGetServerSideProps(origGetServerSideProps: GSSP['fn']): GSSP['wrappedFn'] {
11+
export function withSentryGetServerSideProps(origGetServerSideProps: GSSP['fn'], route: string): GSSP['wrappedFn'] {
1112
return async function (context: GSSP['context']): Promise<GSSP['result']> {
1213
return callOriginal<GSSP>(origGetServerSideProps, context);
1314
};

packages/nextjs/src/config/wrappers/withSentryGetStaticProps.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { callOriginal } from './wrapperUtils';
55
* Create a wrapped version of the user's exported `getStaticProps` function
66
*
77
* @param origGetStaticProps: The user's `getStaticProps` function
8+
* @param route: The page's parameterized route
89
* @returns A wrapped version of the function
910
*/
10-
export function withSentryGetStaticProps(origGetStaticProps: GSProps['fn']): GSProps['wrappedFn'] {
11+
export function withSentryGetStaticProps(origGetStaticProps: GSProps['fn'], route: string): GSProps['wrappedFn'] {
1112
return async function (context: GSProps['context']): Promise<GSProps['result']> {
1213
return callOriginal<GSProps>(origGetStaticProps, context);
1314
};

0 commit comments

Comments
 (0)