@@ -120,32 +120,36 @@ bool ReactInstance::LoadJSBundleFrom(JSBundleSource source, bool reloadHost)
120120{
121121 source_ = source;
122122
123- auto instanceSettings = reactNativeHost_.InstanceSettings ();
124123 switch (source) {
125124 case JSBundleSource::DevServer:
126- instanceSettings.DebugBundlePath (L" index" );
125+ // "Fast Refresh" determines whether the bundle is loaded from the
126+ // dev server (since at least 0.76)
127+ // https://github.com/microsoft/react-native-windows/blob/react-native-windows_v0.76.17/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp#L641
128+ UseFastRefresh (true , reloadHost);
127129 break ;
128130 case JSBundleSource::Embedded:
129- auto const bundleRootPath = GetBundleRootPath ();
130- #if USE_FABRIC
131- instanceSettings.BundleRootPath (L" file://" + bundleRootPath.wstring ());
132- #endif // USE_FABRIC
133- auto const &bundleName = GetBundleName (bundleRootPath, bundleRoot_);
134- if (!bundleName.has_value ()) {
135- return false ;
136- }
137- instanceSettings.JavaScriptBundleFile (bundleName.value ());
131+ UseFastRefresh (false , reloadHost);
138132 break ;
139133 }
140134
141- Reload (reloadHost);
142135 return true ;
143136}
144137
145138void ReactInstance::Reload (bool reloadHost)
146139{
147140 auto instanceSettings = reactNativeHost_.InstanceSettings ();
148141
142+ instanceSettings.DebugBundlePath (L" index" );
143+
144+ auto const bundleRootPath = GetBundleRootPath ();
145+ #if USE_FABRIC
146+ instanceSettings.BundleRootPath (L" file://" + bundleRootPath.wstring ());
147+ #endif // USE_FABRIC
148+ auto const &bundleName = GetBundleName (bundleRootPath, bundleRoot_);
149+ if (bundleName.has_value ()) {
150+ instanceSettings.JavaScriptBundleFile (bundleName.value ());
151+ }
152+
149153#if USE_WEB_DEBUGGER
150154 instanceSettings.UseWebDebugger (UseWebDebugger ());
151155#endif // USE_WEB_DEBUGGER
@@ -243,10 +247,10 @@ bool ReactInstance::UseFastRefresh() const
243247 return IsFastRefreshAvailable () && RetrieveLocalSetting (kUseFastRefresh , true );
244248}
245249
246- void ReactInstance::UseFastRefresh (bool useFastRefresh)
250+ void ReactInstance::UseFastRefresh (bool useFastRefresh, bool reloadHost )
247251{
248252 StoreLocalSetting (kUseFastRefresh , useFastRefresh);
249- Reload ();
253+ Reload (reloadHost );
250254}
251255
252256bool ReactInstance::UseWebDebugger () const
0 commit comments