Skip to content
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

Move ReactFiberErrorDialog RN fork into RN itself #16141

Merged
merged 1 commit into from
Jul 16, 2019
Merged

Move ReactFiberErrorDialog RN fork into RN itself #16141

merged 1 commit into from
Jul 16, 2019

Conversation

motiz88
Copy link
Contributor

@motiz88 motiz88 commented Jul 16, 2019

Along with facebook/react-native#25671, moves the RN-specific implementation of ReactFiberErrorDialog from React to RN. This should only be merged (and subsequently synced to RN) after facebook/react-native#25671 lands.

Also, with this, React doesn't use ExceptionsManager directly anymore, so we remove it from the RN private interface definition.

@sizebot
Copy link

sizebot commented Jul 16, 2019

Details of bundled changes.

Comparing: d9b4c55...7af7722

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -0.1% -0.2% 272.13 KB 271.86 KB 46.75 KB 46.65 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.1% -0.2% 280.63 KB 280.36 KB 48.35 KB 48.23 KB RN_OSS_PROFILING
ReactFabric-prod.js -0.1% -0.2% 266.23 KB 265.96 KB 45.88 KB 45.79 KB RN_OSS_PROD
ReactFabric-profiling.js -0.1% -0.2% 274.94 KB 274.67 KB 47.37 KB 47.29 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.1% -0.2% 722.88 KB 722 KB 153.44 KB 153.13 KB RN_FB_DEV
ReactFabric-prod.js -0.1% -0.2% 266.23 KB 265.97 KB 45.89 KB 45.8 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.1% -0.2% 709.31 KB 708.43 KB 150.83 KB 150.52 KB RN_OSS_DEV
ReactFabric-profiling.js -0.1% -0.2% 274.94 KB 274.67 KB 47.38 KB 47.29 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js -0.1% -0.2% 709.4 KB 708.53 KB 150.88 KB 150.57 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.1% -0.2% 272.13 KB 271.86 KB 46.76 KB 46.66 KB RN_FB_PROD
ReactNativeRenderer-profiling.js -0.1% -0.2% 280.62 KB 280.35 KB 48.35 KB 48.24 KB RN_FB_PROFILING
ReactFabric-dev.js -0.1% -0.2% 722.77 KB 721.9 KB 153.4 KB 153.09 KB RN_OSS_DEV

Generated by 🚫 dangerJS

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cpojer cpojer merged commit c45c2c3 into facebook:master Jul 16, 2019
@motiz88 motiz88 deleted the error-dialog-to-rn branch July 16, 2019 08:42
@threepointone
Copy link
Contributor

Sorry if I've misunderstood, but you did mention that this should only be merged only after facebook/react-native#25671 lands, which it hasn't. Intentional?

(I ask because I'm planning on cutting a new React alpha very soon)

@motiz88
Copy link
Contributor Author

motiz88 commented Jul 16, 2019

@threepointone What I really meant is that this can't be synced to RN before the RN PR lands (side note: it's landing now). It's not actually a blocker to merging or to cutting a React release.

@threepointone
Copy link
Contributor

Good to know, thank you!

facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Jul 31, 2019
Summary:
# Context

In facebook/react#16141 we imported `ReactFiberErrorDialog` unchanged from React. That implementation was not idempotent: if passed the same error instance multiple times, it would amend its `message` property every time, eventually leading to bloat and low-signal logs.

The message bloat problem is most evident when rendering multiple `lazy()` components that expose the same Error reference to React (e.g. due to some cache that vends the same rejected Promise multiple times).

More broadly, there's a need for structured, machine-readable logging to replace stringly-typed interfaces in both the production and development use cases.

# This diff

* We leave the user-supplied `message` field intact and instead do all the formatting inside `ExceptionsManager`. To avoid needless complexity, this **doesn't** always have the exact same output as the old code (but it does come close). See tests for the specifics.
* The only mutation we do on React-captured error instances is setting the `componentStack` expando property. This replaces any previously-captured component stack rather than adding to it, and so doesn't create bloat.
* We also report the exception fields `componentStack`, unformatted `message` (as `originalMessage`) and `name` directly to `NativeExceptionsManager` for future use.

Reviewed By: cpojer

Differential Revision: D16331228

fbshipit-source-id: 7b0539c2c83c7dd4e56db8508afcf367931ac71d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants