From fdc62400185beeb5c35d9066fe561771096e3d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Bigio?= Date: Tue, 17 May 2016 11:45:49 -0700 Subject: [PATCH] Reset hasError flag after HMR request Summary: This got broken recently. As a result of this, when a module throws while being required, either by regular load or hot reload, the module object is marked as `hasError`. Form that point all subsequent HMR updates will fail because it will think the module failed while executing the factory but the failure could have been on an old run of an old factory. The fix is very simple: just reset `hasError` to false when accepting a module. Closes https://github.com/facebook/react-native/pull/7567 Differential Revision: D3310685 fbshipit-source-id: 2f0b48ab7432b7c221d0c88a019a28969a8862b2 --- packager/react-packager/src/Resolver/polyfills/require.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packager/react-packager/src/Resolver/polyfills/require.js b/packager/react-packager/src/Resolver/polyfills/require.js index 219a4bad6..094bdeff3 100644 --- a/packager/react-packager/src/Resolver/polyfills/require.js +++ b/packager/react-packager/src/Resolver/polyfills/require.js @@ -205,6 +205,7 @@ if (__DEV__) { if (factory) { mod.factory = factory; } + mod.hasError = false; mod.isInitialized = false; require(id);