Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(renderer): dynamic views can't be prepended #2262

Merged
merged 1 commit into from Sep 21, 2020

Conversation

edusperoni
Copy link
Collaborator

PR Checklist

What is the current behavior?

The angular renderer doesn't support adding views to the first position:

<StackLayout>
  <ng-container *ngIf="someBoolean">
    <Label text="I come first"></Label>
    <Label text="I come second" *ngIf="someOtherBoolean"></Label>
  </ng-container>
</StackLayout>

Result:

I come second
I come first

This is because the renderer treats not having a previous element as needing to append.

  1. ViewContainer at position 0. StackLayout is empty, StackLayout now contains ViewContainer at 0
  2. add ng-container before ViewContainer (no previous element). StackLayout now contains [VC,ng-container] (should be the other way around). Doubly linked list references are now broken.
  3. add "I come first" before ng-container. [VC, "I come first", ng-container]
  4. add "I come second" before ng-container. [VC, "I come second", "I came first", ng-container] (linked list is broken, so it wraps around from ng-container until "I came first")

What is the new behavior?

  1. ViewContainer at position 0. StackLayout is empty, StackLayout now contains ViewContainer at 0
  2. add ng-container before ViewContainer (no previous element). StackLayout now contains [ng-container,VC]
  3. add "I come first" before ng-container. ["I come first", ng-container, VC]
  4. add "I come second" before ng-container. ["I come first", "I came second", ng-container, VC]

Fixes/Implements/Closes #[Issue Number].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Plugins Team
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants