Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NativeScript/nativescript-angular
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 10.1.3
Choose a base ref
...
head repository: NativeScript/nativescript-angular
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 10.1.4
Choose a head ref
  • 3 commits
  • 6 files changed
  • 2 contributors

Commits on Sep 21, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1dca81b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    07abb9e View commit details
  3. chore(release): 10.1.4

    NathanWalker committed Sep 21, 2020
    Copy the full SHA
    a868c3a View commit details
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [10.1.4](https://github.com/NativeScript/nativescript-angular/compare/10.1.3...10.1.4) (2020-09-21)


### Bug Fixes

* **detached-loader:** detach loadWithFactory ([#2260](https://github.com/NativeScript/nativescript-angular/issues/2260)) ([1dca81b](https://github.com/NativeScript/nativescript-angular/commit/1dca81bbc4a1a05a9eefe13988848124885f3178))
* **renderer:** order not preserved ([#2261](https://github.com/NativeScript/nativescript-angular/issues/2261)) ([07abb9e](https://github.com/NativeScript/nativescript-angular/commit/07abb9e62c2408be83e8a694384cd529ba5d3309))



## [10.1.3](https://github.com/NativeScript/nativescript-angular/compare/10.1.0...10.1.3) (2020-09-21)


9 changes: 8 additions & 1 deletion nativescript-angular/common/detached-loader.ts
Original file line number Diff line number Diff line change
@@ -49,6 +49,13 @@ export class DetachedLoader implements OnDestroy {
}

public loadWithFactory<T>(factory: ComponentFactory<T>): ComponentRef<T> {
return this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.injector, null);
const componentRef = factory.create(this.containerRef.injector);
this.appRef.attachView(componentRef.hostView);

this.disposeFunctions.push(() => {
this.appRef.detachView(componentRef.hostView);
componentRef.destroy();
});
return componentRef;
}
}
2 changes: 2 additions & 0 deletions nativescript-angular/element-registry.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ export interface ViewExtensions {
nodeName: string;
parentNode: NgView;
nextSibling: NgView;
previousSibling: NgView;
firstChild: NgView;
lastChild: NgView;
ngCssClasses: Map<string, boolean>;
@@ -22,6 +23,7 @@ export abstract class InvisibleNode extends View implements NgView {
nodeName: string;
parentNode: NgView;
nextSibling: NgView;
previousSibling: NgView;
firstChild: NgView;
lastChild: NgView;
ngCssClasses: Map<string, boolean>;
2 changes: 1 addition & 1 deletion nativescript-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nativescript/angular",
"version": "10.1.3",
"version": "10.1.4",
"description": "An Angular renderer that lets you build mobile apps with NativeScript.",
"homepage": "https://www.nativescript.org/",
"bugs": "https://github.com/NativeScript/nativescript-angular/issues",
16 changes: 4 additions & 12 deletions nativescript-angular/renderer.ts
Original file line number Diff line number Diff line change
@@ -6,11 +6,6 @@ import { ViewUtil } from './view-util';
import { NgView, InvisibleNode } from './element-registry';
import { NativeScriptDebug } from './trace';

export interface ElementReference {
previous: NgView;
next: NgView;
}

@Injectable()
export class NativeScriptRenderer extends Renderer2 {
data: { [key: string]: any } = Object.create(null);
@@ -31,8 +26,8 @@ export class NativeScriptRenderer extends Renderer2 {
}

@profile
insertBefore(parent: NgView, newChild: NgView, refChild: NgView | ElementReference): void {
let { previous, next } = refChild instanceof View ? this.nextSibling(refChild) : refChild;
insertBefore(parent: NgView, newChild: NgView, refChild: NgView): void {
let { previous, next } = refChild instanceof View ? { previous: refChild.previousSibling, next: refChild } : { previous: null, next: null };
if (NativeScriptDebug.isLogEnabled()) {
NativeScriptDebug.rendererLog(`NativeScriptRenderer.insertBefore child: ${newChild} ` + `parent: ${parent} previous: ${previous} next: ${next}`);
}
@@ -68,15 +63,12 @@ export class NativeScriptRenderer extends Renderer2 {
}

@profile
nextSibling(node: NgView): ElementReference {
nextSibling(node: NgView): NgView {
if (NativeScriptDebug.isLogEnabled()) {
NativeScriptDebug.rendererLog(`NativeScriptRenderer.nextSibling of ${node} is ${node.nextSibling}`);
}

return {
previous: node,
next: node.nextSibling,
};
return node.nextSibling;
}

@profile
10 changes: 9 additions & 1 deletion nativescript-angular/view-util.ts
Original file line number Diff line number Diff line change
@@ -63,12 +63,14 @@ export class ViewUtil {

if (previous) {
previous.nextSibling = child;
child.previousSibling = previous;
} else {
parent.firstChild = child;
}

if (next) {
child.nextSibling = next;
next.previousSibling = child;
} else {
this.appendToQueue(parent, child);
}
@@ -81,6 +83,7 @@ export class ViewUtil {

if (parent.lastChild) {
parent.lastChild.nextSibling = view;
view.previousSibling = parent.lastChild;
}

parent.lastChild = view;
@@ -152,23 +155,28 @@ export class ViewUtil {
parent.firstChild = null;
parent.lastChild = null;
child.nextSibling = null;
child.previousSibling = null;
return;
}

if (parent.firstChild === child) {
parent.firstChild = child.nextSibling;
}

const previous = this.findPreviousElement(parent, child);
const previous = child.previousSibling;
if (parent.lastChild === child) {
parent.lastChild = previous;
}

if (previous) {
previous.nextSibling = child.nextSibling;
if (child.nextSibling) {
child.nextSibling.previousSibling = previous;
}
}

child.nextSibling = null;
child.previousSibling = null;
}

// NOTE: This one is O(n) - use carefully