Skip to content

Commit

Permalink
fix(remix): Don't log missing parameters warning on server-side. (#8269)
Browse files Browse the repository at this point in the history
We are logging a warning when any of the required hooks / functions to
Remix Browser SDK are not available in the Root component.

This Root component is also rendered on server-side where we don't have
access to those functions. And as we're not creating pageload /
navigation transactions there, those functions are not required anyway.

So this PR prevents that warning to be logged on server-side which is
misleading.
  • Loading branch information
onurtemizkan committed Jun 1, 2023
1 parent c368bc8 commit 8c6ad15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/remix/src/performance/client.tsx
@@ -1,7 +1,7 @@
import type { ErrorBoundaryProps} from '@sentry/react';
import type { ErrorBoundaryProps } from '@sentry/react';
import { WINDOW, withErrorBoundary } from '@sentry/react';
import type { Transaction, TransactionContext } from '@sentry/types';
import { logger } from '@sentry/utils';
import { isNodeEnv, logger } from '@sentry/utils';
import * as React from 'react';

const DEFAULT_TAGS = {
Expand Down Expand Up @@ -101,6 +101,7 @@ export function withSentry<P extends Record<string, unknown>, R extends React.FC
// Early return when any of the required functions is not available.
if (!_useEffect || !_useLocation || !_useMatches || !_customStartTransaction) {
__DEBUG_BUILD__ &&
!isNodeEnv() &&
logger.warn('Remix SDK was unable to wrap your root because of one or more missing parameters.');

// @ts-ignore Setting more specific React Component typing for `R` generic above
Expand Down

0 comments on commit 8c6ad15

Please sign in to comment.