Skip to content

Commit 774b0bd

Browse files
committed
UI must be created before first render, drainMicroTasks when the first page is created
1 parent c8a3683 commit 774b0bd

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Diff for: nativescript-angular/platform-common.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,18 @@ export class NativeScriptPlatformRef extends PlatformRef {
207207
reject(err);
208208
}
209209
});
210+
211+
(<any>global).Zone.drainMicroTaskQueue();
210212
});
211213

212214
page.on(Page.navigatingToEvent, initHandler);
213215

214216
return page;
215-
}
217+
},
218+
animated: false
216219
};
217220

218221
if (isReboot) {
219-
navEntry.animated = false;
220222
navEntry.clearHistory = true;
221223
}
222224

Diff for: nativescript-angular/zone-js/dist/zone-nativescript.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
(factory());
1212
}(this, (function () { 'use strict';
1313

14+
const { profile } = require("tns-core-modules/profiling");
15+
1416
/**
1517
* @license
1618
* Copyright Google Inc. All Rights Reserved.
@@ -116,7 +118,7 @@ var Zone$1 = (function (global) {
116118
return zone.runGuarded(_callback, this, arguments, source);
117119
};
118120
};
119-
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
121+
Zone.prototype.run = profile('"zone-nativescript".Zone.run', function (callback, applyThis, applyArgs, source) {
120122
if (applyThis === void 0) { applyThis = undefined; }
121123
if (applyArgs === void 0) { applyArgs = null; }
122124
if (source === void 0) { source = null; }
@@ -127,7 +129,7 @@ var Zone$1 = (function (global) {
127129
finally {
128130
_currentZoneFrame = _currentZoneFrame.parent;
129131
}
130-
};
132+
});
131133
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
132134
if (applyThis === void 0) { applyThis = null; }
133135
if (applyArgs === void 0) { applyArgs = null; }
@@ -581,7 +583,7 @@ var Zone$1 = (function (global) {
581583
catch (err) {
582584
}
583585
}
584-
function drainMicroTaskQueue() {
586+
const drainMicroTaskQueue = profile('"zone-nativescript".drainMicrotaskQueue', function drainMicroTaskQueue() {
585587
if (!_isDrainingMicrotaskQueue) {
586588
_isDrainingMicrotaskQueue = true;
587589
while (_microTaskQueue.length) {
@@ -616,6 +618,7 @@ var Zone$1 = (function (global) {
616618
_isDrainingMicrotaskQueue = false;
617619
}
618620
}
621+
Zone.drainMicroTaskQueue = drainMicroTaskQueue;
619622
function isThenable(value) {
620623
return value && value.then;
621624
}
@@ -1648,7 +1651,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
16481651
return clearNative(task.data.handleId);
16491652
}
16501653
setNative =
1651-
patchMethod(window, setName, function (delegate) { return function (self, args) {
1654+
patchMethod(window, setName, profile('"zone-nativescript" set ' + setName + ' patched', function (delegate) { return function (self, args) {
16521655
if (typeof args[0] === 'function') {
16531656
var zone = Zone.current;
16541657
var options = {
@@ -1676,9 +1679,9 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
16761679
// cause an error by calling it directly.
16771680
return delegate.apply(window, args);
16781681
}
1679-
}; });
1682+
}; }));
16801683
clearNative =
1681-
patchMethod(window, cancelName, function (delegate) { return function (self, args) {
1684+
patchMethod(window, cancelName, profile('"zone-nativescript" clear ' + setName + ' patched', function (delegate) { return function (self, args) {
16821685
var task = typeof args[0] === 'number' ? tasksByHandleId[args[0]] : args[0];
16831686
if (task && typeof task.type === 'string') {
16841687
if (task.state !== 'notScheduled' &&
@@ -1691,7 +1694,7 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
16911694
// cause an error by calling it directly.
16921695
delegate.apply(window, args);
16931696
}
1694-
}; });
1697+
}; }));
16951698
}
16961699

16971700
/**

0 commit comments

Comments
 (0)