Skip to content

Commit 8cb726a

Browse files
authored
fix-next: avoid circular reference (NativeScript#6812)
1 parent 19dfd16 commit 8cb726a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

tns-core-modules/application/application-common.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require("globals");
33

44
import { Observable, EventData } from "../data/observable";
5+
import { View } from "../ui/core/view";
56
import {
67
trace as profilingTrace,
78
time,
@@ -35,7 +36,6 @@ export { Observable };
3536
import {
3637
AndroidApplication,
3738
CssChangedEventData,
38-
getRootView,
3939
iOSApplication,
4040
LoadAppCSSEventData,
4141
UnhandledErrorEventData,
@@ -79,10 +79,10 @@ export function setApplication(instance: iOSApplication | AndroidApplication): v
7979
app = instance;
8080
}
8181

82-
export function livesync(context?: HmrContext) {
82+
export function livesync(rootView: View, context?: HmrContext) {
8383
events.notify(<EventData>{ eventName: "livesync", object: app });
8484
const liveSyncCore = global.__onLiveSyncCore;
85-
let reapplyAppCss = false
85+
let reapplyAppCss = false;
8686

8787
if (context) {
8888
const fullFileName = getCssFileName();
@@ -91,7 +91,6 @@ export function livesync(context?: HmrContext) {
9191
reapplyAppCss = extensions.some(ext => context.module === fileName.concat(ext));
9292
}
9393

94-
const rootView = getRootView();
9594
if (reapplyAppCss && rootView) {
9695
rootView._onCssStateChange();
9796
} else if (liveSyncCore) {

tns-core-modules/application/application.android.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) {
217217
return;
218218
}
219219

220-
livesync(context);
220+
const rootView = getRootView();
221+
livesync(rootView, context);
221222
};
222223

223224
function initLifecycleCallbacks() {

tns-core-modules/application/application.ios.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { Frame, NavigationEntry } from "../ui/frame";
2121
import * as utils from "../utils/utils";
2222
import { profile, level as profilingLevel, Level } from "../profiling";
2323

24-
// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430
24+
// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430
2525
// TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved:
2626
// https://github.com/NativeScript/ios-runtime/issues/1012
2727
var Responder = (<any>UIResponder).extend({
@@ -161,7 +161,7 @@ class IOSApplication implements IOSApplicationDefinition {
161161
this.setWindowContent(args.root);
162162
} else {
163163
this._window = UIApplication.sharedApplication.delegate.window;
164-
}
164+
}
165165
}
166166

167167
@profile
@@ -378,5 +378,6 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) {
378378
return;
379379
}
380380

381-
livesync(context);
381+
const rootView = getRootView();
382+
livesync(rootView, context);
382383
}

0 commit comments

Comments
 (0)