autoWrapExpoRouterErrorBoundary is opt-in but could be the default

未關閉
#6,738 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
45/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
react-native, typescript

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.
主要語言
TypeScript
星號
1.8k
分支
371
平均合併
22 小時 3 分鐘
30 天內合併 PR
106

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-react-native 的其他 Issue

查看 getsentry/sentry-react-native 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。