From c54f5cf72a3fdf794f2e70283fd291d669d66e2b Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Thu, 14 Nov 2019 12:03:54 -0800 Subject: [PATCH] LogBox - Only dismiss syntax errors when the issue is fixed Summary: This change is not only more correct, it's also fixes the modal in the the next diff. It's more accurate because in the previous location, the redbox dismissal was done as a hack in order to hide non-syntax errors so that the syntax error would be visible when it fired. This is unnecessary for LogBox because it always puts syntax errors on top of any other error. The main motivation for changing this, however, is that this strategy is broken when switching to the Modal component because the Modal component does not work well with quickly unmounting and remounting. With the old strategy, the inspector would flicker and then collapse even though there was a syntax error. Changelog: [Internal] Reviewed By: cpojer, gaearon Differential Revision: D18461431 fbshipit-source-id: e8ed83e3d2b002e5d45cc13dc9533ed841ed5cae --- Libraries/Utilities/HMRClient.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index 0b1ad36f5d5..c29b8770c2b 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -211,6 +211,7 @@ Error: ${e.message}`; client.on('update', ({isInitialUpdate}) => { if (client.isEnabled() && !isInitialUpdate) { dismissRedbox(); + LogBoxData.clearSyntaxErrors(); } }); @@ -297,8 +298,6 @@ function flushEarlyLogs(client) { } function dismissRedbox() { - LogBoxData.clearSyntaxErrors(); - if ( Platform.OS === 'ios' && NativeRedBox != null &&