Skip to content

Commit

Permalink
Add reloadWithReason to Fast Refresh
Browse files Browse the repository at this point in the history
Summary: This diff adds reload reasons to Fast Refresh. This will help us understand why, for internal Facebook users, Fast Refresh is bailing out to a full reload so that we can improve it for everyone.

Reviewed By: cpojer

Differential Revision: D17499348

fbshipit-source-id: b6e73dc3f396c8531a0872f5572a13928450bb3b
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Sep 30, 2019
1 parent 549cac6 commit 4cea628
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Libraries/Core/setUpReactRefresh.js
Expand Up @@ -10,10 +10,9 @@
'use strict';

if (__DEV__) {
const NativeDevSettings = require('../NativeModules/specs/NativeDevSettings')
.default;
const DevSettings = require('../Utilities/DevSettings');

if (typeof NativeDevSettings.reload !== 'function') {
if (typeof DevSettings.reload !== 'function') {
throw new Error('Could not find the reload() implementation.');
}

Expand All @@ -22,8 +21,8 @@ if (__DEV__) {
ReactRefreshRuntime.injectIntoGlobalHook(global);

const Refresh = {
performFullRefresh() {
NativeDevSettings.reload();
performFullRefresh(reason: string) {
DevSettings.reload(reason);
},

createSignatureFunctionForTransform:
Expand All @@ -37,7 +36,7 @@ if (__DEV__) {

performReactRefresh() {
if (ReactRefreshRuntime.hasUnrecoverableErrors()) {
NativeDevSettings.reload();
DevSettings.reload('Fast Refresh - Unrecoverable');
return;
}
ReactRefreshRuntime.performReactRefresh();
Expand Down

0 comments on commit 4cea628

Please sign in to comment.