From 76eabd478ecaffdd287dde4ce8850b99a72f9e91 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 20 Feb 2024 18:23:01 +0100 Subject: [PATCH 01/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index b21b88dfe4..9d57c271cb 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit b21b88dfe4a95222b9f64e0a665cdba34fce778d +Subproject commit 9d57c271cb05dfbe2fcedb55e667a224b7ccfdc8 From b753732629f4402522d154eff955230b066954d0 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 20 Feb 2024 18:23:26 +0100 Subject: [PATCH 02/29] Add error logging setup --- src/errorLogging/index.js | 38 ++++++++++++++++++++++++++++++++++++++ src/setup.js | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 src/errorLogging/index.js diff --git a/src/errorLogging/index.js b/src/errorLogging/index.js new file mode 100644 index 0000000000..6f095d5148 --- /dev/null +++ b/src/errorLogging/index.js @@ -0,0 +1,38 @@ +/** + * WordPress dependencies + */ +import { logException } from '@wordpress/react-native-bridge'; + +// Setting Error handler to send exception. This implemenetation is based on Sentry React Native SDK: +// https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L187-L262 +export default () => { + const errorUtils = global.ErrorUtils; + const defaultHandler = + errorUtils.getGlobalHandler && errorUtils.getGlobalHandler(); + + let handlingFatal = false; + errorUtils.setGlobalHandler( ( error, isFatal ) => { + // We want to handle fatals, but only in production mode. + const shouldHandleFatal = isFatal && ! __DEV__; + if ( shouldHandleFatal ) { + if ( handlingFatal ) { + // eslint-disable-next-line no-console + console.warn( + 'Encountered multiple fatals in a row. The latest:', + error + ); + return; + } + handlingFatal = true; + } + + // TODO: Set severity and exception mechanism. + // https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L235-L239 + + // Send exception to the host app. + logException( error ); + + // TODO: Wait for the exception to be sent to host app. + defaultHandler( error, isFatal ); + } ); +}; diff --git a/src/setup.js b/src/setup.js index c5ecd6d20a..03dab19417 100644 --- a/src/setup.js +++ b/src/setup.js @@ -9,6 +9,7 @@ import { initialHtmlGutenberg } from '@wordpress/react-native-editor'; */ import initialHtml from './initial-html'; import initAnalytics from './analytics'; +import initErrorLogging from './errorLogging'; const setupHooks = () => { // Hook triggered before the editor is rendered @@ -75,4 +76,5 @@ const setupHooks = () => { export default () => { initAnalytics(); setupHooks(); + initErrorLogging(); }; From 24f4aa012977f5371c9a8425afc73fb8969ec303 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 22 Feb 2024 16:31:06 +0100 Subject: [PATCH 03/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 9d57c271cb..1c9384e560 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 9d57c271cb05dfbe2fcedb55e667a224b7ccfdc8 +Subproject commit 1c9384e56012b55dcd64104c5ddb8b7dc2c2c52f From ae8851cde9bfb097e678e07860aef4271b85b817 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 22 Feb 2024 18:20:23 +0100 Subject: [PATCH 04/29] Add bundle and source map files to gitignore --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a4f0ea5172..b430ab05bd 100644 --- a/.gitignore +++ b/.gitignore @@ -40,10 +40,7 @@ gen/ build/ build.log bundle/android/raw/* -bundle/android/App.js -bundle/android/App.js.map -bundle/android/App.text.js -bundle/android/App.text.js.map +bundle/android/App.* bundle/ios/App.* bundle/ios/assets/gutenberg/packages/block-library/src/* From 4556a29449d694300d2efda1bf536916ab913c2c Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 22 Feb 2024 18:20:46 +0100 Subject: [PATCH 05/29] Include source map when generating the xcframework --- ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj b/ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj index 47085505bf..e94d30ebd5 100644 --- a/ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj +++ b/ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1D9EA4BE2B87A2570086B30F /* App.composed.js.map in Resources */ = {isa = PBXBuildFile; fileRef = 1D9EA4BD2B87A2470086B30F /* App.composed.js.map */; }; 3F1235FE29F680F900AF54A4 /* GutenbergBridgeDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F1235FB29F680F900AF54A4 /* GutenbergBridgeDelegate.swift */; }; 3F1235FF29F680F900AF54A4 /* GutenbergBridgeDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F1235FC29F680F900AF54A4 /* GutenbergBridgeDataSource.swift */; }; 3F12360029F680F900AF54A4 /* Gutenberg.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F1235FD29F680F900AF54A4 /* Gutenberg.swift */; }; @@ -39,6 +40,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1D9EA4BD2B87A2470086B30F /* App.composed.js.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; name = App.composed.js.map; path = ../../../bundle/ios/App.composed.js.map; sourceTree = ""; }; 3F1235FB29F680F900AF54A4 /* GutenbergBridgeDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GutenbergBridgeDelegate.swift; path = "../../gutenberg/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift"; sourceTree = ""; }; 3F1235FC29F680F900AF54A4 /* GutenbergBridgeDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GutenbergBridgeDataSource.swift; path = "../../gutenberg/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift"; sourceTree = ""; }; 3F1235FD29F680F900AF54A4 /* Gutenberg.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Gutenberg.swift; path = "../../gutenberg/packages/react-native-bridge/ios/Gutenberg.swift"; sourceTree = ""; }; @@ -90,6 +92,7 @@ isa = PBXGroup; children = ( 3FA0C5802A1C8C9700600A9A /* App.js */, + 1D9EA4BD2B87A2470086B30F /* App.composed.js.map */, 3F12363F29F6B21300AF54A4 /* content-functions.js */, 3F12364429F6B21300AF54A4 /* editor-behavior-overrides.js */, 3F12363D29F6B21300AF54A4 /* editor-style-overrides.css */, @@ -262,6 +265,7 @@ 3F12364C29F6B21300AF54A4 /* wp-bar-override.css in Resources */, 3F12365029F6B23300AF54A4 /* supported-blocks.json in Resources */, 3FA0C5812A1C8C9700600A9A /* App.js in Resources */, + 1D9EA4BE2B87A2570086B30F /* App.composed.js.map in Resources */, 3F12364729F6B21300AF54A4 /* insert-block.js in Resources */, ); runOnlyForDeploymentPostprocessing = 0; From 2afe0f47fa300b062c6c1d6d45ca63c1039bd4fe Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 22 Feb 2024 18:24:23 +0100 Subject: [PATCH 06/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 1c9384e560..53b2f2ed9c 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 1c9384e56012b55dcd64104c5ddb8b7dc2c2c52f +Subproject commit 53b2f2ed9c1ddba2436fe1601429fe8dde7d26d2 From 6fd186288b776d27d15857461f7de64f7c581cff Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 22 Feb 2024 18:27:53 +0100 Subject: [PATCH 07/29] Upload source map artifact during JS bundle generation --- ...lish-react-native-bridge-android-artifacts.sh | 1 + .../publish-react-native-ios-artifacts.sh | 1 + .buildkite/pipeline.yml | 16 ++++++---------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh b/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh index 80fdd14497..33682df292 100755 --- a/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh +++ b/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh @@ -5,6 +5,7 @@ set -euo pipefail # Retrieve data from previous steps PUBLISHED_AZTEC_VERSION=`buildkite-agent meta-data get "PUBLISHED_REACT_NATIVE_AZTEC_ANDROID_VERSION"` buildkite-agent artifact download bundle/android/App.js . +buildkite-agent artifact download bundle/android/App.composed.js.map . # Copy the JavaScript bundle and all local static assets referenced within the # bundle to the appropriate locations for inclusion in the bridge bundle diff --git a/.buildkite/commands/publish-react-native-ios-artifacts.sh b/.buildkite/commands/publish-react-native-ios-artifacts.sh index d9dbb8a241..5a677b5f42 100755 --- a/.buildkite/commands/publish-react-native-ios-artifacts.sh +++ b/.buildkite/commands/publish-react-native-ios-artifacts.sh @@ -2,6 +2,7 @@ echo "--- :arrow_down: Download iOS JS bundle" buildkite-agent artifact download bundle/ios/App.js . +buildkite-agent artifact download bundle/ios/App.composed.js.map . buildkite-agent artifact download ios-assets.tar.gz . mkdir -p ios-xcframework/Gutenberg/Resources tar -xzvf ios-assets.tar.gz -C ios-xcframework/Gutenberg/Resources/ diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 794dce8c2f..892c6347bb 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -142,11 +142,9 @@ steps: echo "--- :arrow_up: Upload Android bundle artifact" buildkite-agent artifact upload bundle/android/App.js - if [[ -n "$BUILDKITE_TAG" ]]; then - echo "--- :arrow_up: Upload Android source map" - node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/android/App.text.js.map bundle/android/App.js.map -o bundle/android/App.composed.js.map - buildkite-agent artifact upload bundle/android/App.composed.js.map - fi + echo "--- :arrow_up: Upload Android source map" + node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/android/App.text.js.map bundle/android/App.js.map -o bundle/android/App.composed.js.map + buildkite-agent artifact upload bundle/android/App.composed.js.map echo "--- :ios: Build iOS bundle" npm run bundle:ios @@ -156,11 +154,9 @@ steps: tar -czvf ios-assets.tar.gz -C ios-xcframework/Gutenberg/Resources assets/ buildkite-agent artifact upload ios-assets.tar.gz - if [[ -n "$BUILDKITE_TAG" ]]; then - echo "--- :arrow_up: Upload iOS source map" - node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/ios/App.text.js.map bundle/ios/App.js.map -o bundle/ios/App.composed.js.map - buildkite-agent artifact upload bundle/ios/App.composed.js.map - fi + echo "--- :arrow_up: Upload iOS source map" + node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/ios/App.text.js.map bundle/ios/App.js.map -o bundle/ios/App.composed.js.map + buildkite-agent artifact upload bundle/ios/App.composed.js.map - label: "Build Android RN Aztec & Publish to S3" depends_on: From b3db68465dd7859bbc5b9d8cefb238b9bd4199b9 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 23 Feb 2024 19:16:14 +0100 Subject: [PATCH 08/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 53b2f2ed9c..bc67ebb014 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 53b2f2ed9c1ddba2436fe1601429fe8dde7d26d2 +Subproject commit bc67ebb0140bc87d31fbfe83964093959e6510c5 From ecb8b0ab853b110fed3807d16f1bbfe8681eaabe Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 23 Feb 2024 19:15:31 +0100 Subject: [PATCH 09/29] Trigger default error handler after sending an unhandled JS exception --- src/errorLogging/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/errorLogging/index.js b/src/errorLogging/index.js index 6f095d5148..4842d19973 100644 --- a/src/errorLogging/index.js +++ b/src/errorLogging/index.js @@ -30,7 +30,9 @@ export default () => { // https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L235-L239 // Send exception to the host app. - logException( error ); + logException( error, {}, () => { + defaultHandler( error, isFatal ); + } ); // TODO: Wait for the exception to be sent to host app. defaultHandler( error, isFatal ); From 19d9b7f0902885be0e2abacd2f31e57cad7005c9 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 23 Feb 2024 19:43:48 +0100 Subject: [PATCH 10/29] Call default error handler only after the exception is sent --- src/errorLogging/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/errorLogging/index.js b/src/errorLogging/index.js index 4842d19973..d141b9e6cf 100644 --- a/src/errorLogging/index.js +++ b/src/errorLogging/index.js @@ -29,12 +29,9 @@ export default () => { // TODO: Set severity and exception mechanism. // https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L235-L239 - // Send exception to the host app. logException( error, {}, () => { + // Wait for the exception to be sent to host app. defaultHandler( error, isFatal ); } ); - - // TODO: Wait for the exception to be sent to host app. - defaultHandler( error, isFatal ); } ); }; From d883dd2d07b79ea466d096cfa5a1fbd2cb3c45ed Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 26 Feb 2024 12:36:08 +0100 Subject: [PATCH 11/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index bc67ebb014..12aff798a3 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit bc67ebb0140bc87d31fbfe83964093959e6510c5 +Subproject commit 12aff798a3c3f0fb598f520a7901b86ed337cb9c From 6a50374aa5d1dd6475826a61ea0801b61e90fdea Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 26 Feb 2024 12:59:58 +0100 Subject: [PATCH 12/29] Generate composed source map after creating bundles --- .buildkite/pipeline.yml | 12 +++--------- package.json | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 161bf23b7f..66ea21eeec 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -143,25 +143,19 @@ steps: echo "--- :android: Build Android bundle" npm run bundle:android - echo "--- :arrow_up: Upload Android bundle artifact" + echo "--- :arrow_up: Upload Android bundle and source map artifacts" buildkite-agent artifact upload bundle/android/App.js - - echo "--- :arrow_up: Upload Android source map" - node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/android/App.text.js.map bundle/android/App.js.map -o bundle/android/App.composed.js.map buildkite-agent artifact upload bundle/android/App.composed.js.map echo "--- :ios: Build iOS bundle" npm run bundle:ios - echo "--- :arrow_up: Upload iOS bundle artifact" + echo "--- :arrow_up: Upload iOS bundle and source map artifacts" buildkite-agent artifact upload bundle/ios/App.js + buildkite-agent artifact upload bundle/ios/App.composed.js.map tar -czvf ios-assets.tar.gz -C ios-xcframework/Gutenberg/Resources assets/ buildkite-agent artifact upload ios-assets.tar.gz - echo "--- :arrow_up: Upload iOS source map" - node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/ios/App.text.js.map bundle/ios/App.js.map -o bundle/ios/App.composed.js.map - buildkite-agent artifact upload bundle/ios/App.composed.js.map - - label: "Build Android RN Aztec & Publish to S3" depends_on: - lint diff --git a/package.json b/package.json index 0e22b19f68..9656976659 100644 --- a/package.json +++ b/package.json @@ -73,10 +73,10 @@ "bundle": "npm run clean && npm run bundle:js", "prebundle:js": "npm run i18n:update", "bundle:js": "npm run bundle:android && npm run bundle:ios", - "bundle:android": "npm run bundle:android:text && npm run bundle:android:bytecode", + "bundle:android": "npm run bundle:android:text && npm run bundle:android:bytecode && node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/android/App.text.js.map bundle/android/App.js.map -o bundle/android/App.composed.js.map", "bundle:android:text": "mkdir -p bundle/android && npm run rn-bundle -- --platform android --dev false --entry-file ./index.js --assets-dest ./bundle/android --bundle-output ./bundle/android/App.text.js --sourcemap-output ./bundle/android/App.text.js.map", "bundle:android:bytecode": "./gutenberg/node_modules/react-native/sdks/hermesc/`node -e \"const platform=require('os').platform();console.log(platform === 'darwin' ? 'osx-bin' : (platform === 'linux' ? 'linux64-bin' : (platform === 'win32' ? 'win64-bin' : 'unsupported-os')));\"`/hermesc -emit-binary -O -out bundle/android/App.js bundle/android/App.text.js -output-source-map", - "bundle:ios": "npm run bundle:ios:text && npm run bundle:ios:bytecode", + "bundle:ios": "npm run bundle:ios:text && npm run bundle:ios:bytecode && node gutenberg/node_modules/react-native/scripts/compose-source-maps.js bundle/ios/App.text.js.map bundle/ios/App.js.map -o bundle/ios/App.composed.js.map", "bundle:ios:text": "mkdir -p bundle/ios && npm run rn-bundle -- --platform ios --dev false --entry-file ./index.js --assets-dest ./ios-xcframework/Gutenberg/Resources --bundle-output ./bundle/ios/App.text.js --sourcemap-output ./bundle/ios/App.text.js.map", "bundle:ios:bytecode": "./gutenberg/node_modules/react-native/sdks/hermesc/`node -e \"const platform=require('os').platform();console.log(platform === 'darwin' ? 'osx-bin' : (platform === 'linux' ? 'linux64-bin' : (platform === 'win32' ? 'win64-bin' : 'unsupported-os')));\"`/hermesc -emit-binary -O -out bundle/ios/App.js bundle/ios/App.text.js -output-source-map", "prewpandroid": "rm -Rf $TMPDIR/gbmobile-wpandroidfakernroot && mkdir $TMPDIR/gbmobile-wpandroidfakernroot && ln -s $(cd \"$(dirname \"../../../\")\"; pwd) $TMPDIR/gbmobile-wpandroidfakernroot/android", From 815fd89601880ab81dbf1a8a220272876f2da34a Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 15:56:40 +0100 Subject: [PATCH 13/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 12aff798a3..5f4e20864f 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 12aff798a3c3f0fb598f520a7901b86ed337cb9c +Subproject commit 5f4e20864fcadb44ef33df2efe253f8bae1f04a7 From 61ba3448d5e2dbc09ea3a48fbc5a30202c0a8b66 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 15:57:46 +0100 Subject: [PATCH 14/29] Mark exceptions detected by error handler as unhandled --- src/errorLogging/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/errorLogging/index.js b/src/errorLogging/index.js index d141b9e6cf..83efa66b7f 100644 --- a/src/errorLogging/index.js +++ b/src/errorLogging/index.js @@ -26,12 +26,13 @@ export default () => { handlingFatal = true; } - // TODO: Set severity and exception mechanism. - // https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L235-L239 - - logException( error, {}, () => { - // Wait for the exception to be sent to host app. - defaultHandler( error, isFatal ); - } ); + logException( + error, + { isHandled: false, handledBy: 'Global Error Handler' }, + () => { + // Wait for the exception to be sent to host app + defaultHandler( error, isFatal ); + } + ); } ); }; From 6bd6d87a9a398c7ce6fd27629167759bbbac338d Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 16:09:00 +0100 Subject: [PATCH 15/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 5f4e20864f..35338bece5 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 5f4e20864fcadb44ef33df2efe253f8bae1f04a7 +Subproject commit 35338bece5ccd83f3a53c272f5078c628fb3c93a From 2640b6da440cb41a460651a645c9d37e8a0cf037 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 16:20:38 +0100 Subject: [PATCH 16/29] Limit exception logging to fatal errors --- src/errorLogging/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/errorLogging/index.js b/src/errorLogging/index.js index 83efa66b7f..e069b39bdb 100644 --- a/src/errorLogging/index.js +++ b/src/errorLogging/index.js @@ -3,7 +3,7 @@ */ import { logException } from '@wordpress/react-native-bridge'; -// Setting Error handler to send exception. This implemenetation is based on Sentry React Native SDK: +// Setting Error handler to send exceptions. This implementation is based on Sentry React Native SDK: // https://github.com/getsentry/sentry-react-native/blob/adfb66f16438dfd98f280307844778c7291b584b/src/js/integrations/reactnativeerrorhandlers.ts#L187-L262 export default () => { const errorUtils = global.ErrorUtils; @@ -12,9 +12,15 @@ export default () => { let handlingFatal = false; errorUtils.setGlobalHandler( ( error, isFatal ) => { - // We want to handle fatals, but only in production mode. - const shouldHandleFatal = isFatal && ! __DEV__; - if ( shouldHandleFatal ) { + // For now, only fatal errors are logged + if ( ! isFatal ) { + defaultHandler( error, isFatal ); + return; + } + + // On production, we only allow logging a single fatal error. + // This prevents sending extra exceptions derived from the original error. + if ( ! __DEV__ ) { if ( handlingFatal ) { // eslint-disable-next-line no-console console.warn( From 3785095392c6e094fb8ef75576de8fd422c544fd Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 16:45:01 +0100 Subject: [PATCH 17/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 35338bece5..5457c0e5e6 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 35338bece5ccd83f3a53c272f5078c628fb3c93a +Subproject commit 5457c0e5e69d12f48284240d1094d7c8396a7ac2 From 0003382938cb7be9cf09262b550d3f7224aab0d6 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 18:50:01 +0100 Subject: [PATCH 18/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 5457c0e5e6..260cb3afd5 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 5457c0e5e69d12f48284240d1094d7c8396a7ac2 +Subproject commit 260cb3afd5b426fb958f4f7645f4fbe81b50f079 From 556f6ad9b1905585e3105181ea9d5a86422e82d1 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 27 Feb 2024 18:52:44 +0100 Subject: [PATCH 19/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 260cb3afd5..a598b7701e 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 260cb3afd5b426fb958f4f7645f4fbe81b50f079 +Subproject commit a598b7701e7d209d52bf755d8f621310fa2c1386 From cdf9bfdf2b253ebed864a57875c821c7958226bd Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 28 Feb 2024 10:00:57 +0100 Subject: [PATCH 20/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index a598b7701e..c017e122aa 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit a598b7701e7d209d52bf755d8f621310fa2c1386 +Subproject commit c017e122aa58dbfcc5e33fad72a1b9207ac77880 From f1698d65c22ce90a9552e0c6ce316c3c50d10660 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 28 Feb 2024 17:48:10 +0100 Subject: [PATCH 21/29] Include source map to Android assets --- .../commands/publish-react-native-bridge-android-artifacts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh b/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh index 33682df292..c771bc6836 100755 --- a/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh +++ b/.buildkite/commands/publish-react-native-bridge-android-artifacts.sh @@ -11,6 +11,7 @@ buildkite-agent artifact download bundle/android/App.composed.js.map . # bundle to the appropriate locations for inclusion in the bridge bundle mkdir -p gutenberg/packages/react-native-bridge/android/react-native-bridge/build/assets cp ./bundle/android/App.js ./gutenberg/packages/react-native-bridge/android/react-native-bridge/build/assets/index.android.bundle +cp ./bundle/android/App.composed.js.map ./gutenberg/packages/react-native-bridge/android/react-native-bridge/build/assets/index.android.bundle.map cp -r ./bundle/android/drawable-* ./gutenberg/packages/react-native-bridge/android/react-native-bridge/src/main/res/ # Publish react-native-bridge From c06df89074f3abadbe81cd1ce07d15d030906492 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 12:47:35 +0100 Subject: [PATCH 22/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index c017e122aa..7c18727c5d 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit c017e122aa58dbfcc5e33fad72a1b9207ac77880 +Subproject commit 7c18727c5dd0412d926fc4456b4e585b063fee9d From 32e5e932c7564728d254d38c8224a87b8aec07a0 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 13:25:38 +0100 Subject: [PATCH 23/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 7c18727c5d..363cb123ba 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 7c18727c5dd0412d926fc4456b4e585b063fee9d +Subproject commit 363cb123ba416622269c45acaf5e8df23a9151e9 From a88a07389f55bcf5a233a57ff01802dbe3968a04 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 29 Feb 2024 13:31:41 +0100 Subject: [PATCH 24/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 363cb123ba..294ac995f1 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 363cb123ba416622269c45acaf5e8df23a9151e9 +Subproject commit 294ac995f105865f35729238de479938d7cbe0b1 From 3b6fab297f14013e4031cb68910c3677b58812df Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 6 Mar 2024 18:27:58 +0100 Subject: [PATCH 25/29] build: Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 7dadd4ada2..2002dcf1d0 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 7dadd4ada2436fddb52398ea0f1ce2de36dc122c +Subproject commit 2002dcf1d0b659d9d7da9199f5f6d7db3e118e81 From 585cc17c671351bb45893231dec8e69456859b2f Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 6 Mar 2024 18:28:55 +0100 Subject: [PATCH 26/29] Update release notes --- RELEASE-NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 557f42492d..845e0221ad 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,7 @@ Unreleased --- * [**] [internal] Upgrade React Native to version 0.73.3 [https://github.com/wordpress-mobile/gutenberg-mobile/pull/6590] +* [**] Add error boundary components and exception logging [https://github.com/wordpress-mobile/gutenberg-mobile/pull/6655] 1.114.0 --- From 39749cc4fcc1176074c1550e3645ae814a174750 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Wed, 6 Mar 2024 18:53:03 +0100 Subject: [PATCH 27/29] build: Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 2002dcf1d0..cfaf638af7 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 2002dcf1d0b659d9d7da9199f5f6d7db3e118e81 +Subproject commit cfaf638af7bd2904c546cc955f708bc87f57dc28 From 46d7600c3a310d0957002f81db5a54a1eb9306f9 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 7 Mar 2024 16:40:33 +0100 Subject: [PATCH 28/29] Update Gutenberg ref --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index cfaf638af7..49f32e7735 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit cfaf638af7bd2904c546cc955f708bc87f57dc28 +Subproject commit 49f32e7735bc5a3a8255c2dae1d31d23327e57d1 From 1e665f9105de190ac8c8ebb5872ccc4f4ca143d2 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Mon, 11 Mar 2024 10:42:04 +0100 Subject: [PATCH 29/29] Update Gutenberg ref with merge commit --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 49f32e7735..ef63dcc089 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 49f32e7735bc5a3a8255c2dae1d31d23327e57d1 +Subproject commit ef63dcc0890dbea12e61f4e2cde55c04614eeb4a