Skip to content

Commit

Permalink
fix(nextjs/v7): Use passthrough createReduxEnhancer on server (#11010)
Browse files Browse the repository at this point in the history
Fixes #10366
  • Loading branch information
lforst authored Mar 11, 2024
1 parent 3588dc0 commit 607104c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
"test:assert": "pnpm test:prod && pnpm test:dev"
},
"dependencies": {
"@playwright/test": "^1.27.1",
"@sentry/nextjs": "latest || *",
"@types/node": "18.11.17",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"next": "14.0.4",
"next": "14.1.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.5",
"wait-port": "1.0.4",
"ts-node": "10.9.1",
"@playwright/test": "^1.27.1"
"typescript": "4.9.5",
"wait-port": "1.0.4"
},
"devDependencies": {
"@sentry/types": "latest || *",
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export declare const rewriteFramesIntegration: typeof clientSdk.rewriteFramesInt
export declare function getSentryRelease(fallback?: string): string | undefined;

export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary;
export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer;
export declare const showReportDialog: typeof clientSdk.showReportDialog;
export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary;

Expand Down
8 changes: 7 additions & 1 deletion packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Http } from './httpIntegration';
import { OnUncaughtException } from './onUncaughtExceptionIntegration';
import { rewriteFramesIntegration } from './rewriteFramesIntegration';

export { createReduxEnhancer } from '@sentry/react';
export * from '@sentry/node';
export { captureUnderscoreErrorException } from '../common/_error';

Expand Down Expand Up @@ -46,6 +45,13 @@ export const ErrorBoundary = (props: React.PropsWithChildren<unknown>): React.Re
return props.children as React.ReactNode;
};

/**
* A passthrough redux enhancer for the server that doesn't depend on anything from the `@sentry/react` package.
*/
export function createReduxEnhancer() {
return (createStore: unknown) => createStore;
}

/**
* A passthrough error boundary wrapper for the server that doesn't depend on any react. Error boundaries don't catch
* SSR errors so they should simply be a passthrough.
Expand Down

0 comments on commit 607104c

Please sign in to comment.