autoWrapExpoRouterErrorBoundary is opt-in but could be the default

Ouverte
#6,738 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
45/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
react-native, typescript
Domaine
build-system, mobile

Piste de recherche

Start in packages/core/src/js/tools/metroconfig.ts and trace autoWrapExpoRouterErrorBoundary through withSentryConfig and getSentryExpoConfig. Validate the Babel rewrite against the supported Expo Router versions and route layouts, including aliased exports and existing imports. Done means a decided default for the next major version, with an escape hatch if needed, plus coverage for the validated structures.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Breaking Change Next Major React-Native

autoWrapExpoRouterErrorBoundary (in withSentryConfig/getSentryExpoConfig, packages/core/src/js/tools/metroconfig.ts) auto-wraps Expo Router's per-route ErrorBoundary re-exports with Sentry.wrapExpoRouterErrorBoundary at build time, so render-phase errors that hit the fallback get captured without the user touching their route files.

It currently defaults to false (getsentry/sentry-react-native#6347), so Expo Router users only get this error capture if they know the option exists and opt in explicitly:

module.exports = getSentryExpoConfig(__dirname, {
  autoWrapExpoRouterErrorBoundary: true,
});

Since the whole point is capturing errors users wouldn't otherwise think to instrument, most Expo Router apps are silently missing this coverage. Worth considering flipping the default to true in the next major version.

Needs scoping before landing:

  • Confirm the babel rewrite (detecting export { ErrorBoundary } from 'expo-router' and aliased variants) is safe to apply unconditionally across the range of Expo Router versions/route layouts we support - it already skips files that already import wrapExpoRouterErrorBoundary, but should be validated against a wider set of real app structures.
  • Decide whether this should ship default-on directly in 9.0, or default-on with an escape hatch (autoWrapExpoRouterErrorBoundary: false) for a deprecation cycle.
Langage dominant
TypeScript
Étoiles
1.8k
Forks
371
Merge moyen
22 h 3 min
PR mergées (30 j)
106

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de getsentry/sentry-react-native

Toutes les issues de getsentry/sentry-react-native

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.