Skip to content

fix(nextjs/v7): Use passthrough createReduxEnhancer on server #11010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2024
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 @@ -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