Skip to content

ActionBarExtension throws when adding/removing new items dynamically #978

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

Closed
sis0k0 opened this issue Sep 4, 2017 · 0 comments · Fixed by #979
Closed

ActionBarExtension throws when adding/removing new items dynamically #978

sis0k0 opened this issue Sep 4, 2017 · 0 comments · Fixed by #979
Assignees
Milestone

Comments

@sis0k0
Copy link
Contributor

sis0k0 commented Sep 4, 2017

When there's no explicit ActionBar directive defined in the Page, the default one doesn't have meta information (insertChild, removeChild methods) attached to it.
Let's say we create an ActionBarExtension with an ActionItem in that Page.

<ActionBarExtension>
    <ActionItem (tap)="show = !show" text="toggle">
    </ActionItem>

    <ActionItem *ngIf="show" text="conditional">
    </ActionItem>
</ActionBarExtension>

If we remove the ActionItem dynamically, the renderer will call the generic _removeView (that's because the default ActionBar doesn't have meta, as mentioned above). This results in the following error:

JS: ERROR Error: View not added to this instance. View: [object Object] CurrentParent: undefined ExpectedParent: ActionBar(3)

related to #942
thanks to @madakk for reporting

@sis0k0 sis0k0 added this to the 4.3 milestone Sep 4, 2017
@sis0k0 sis0k0 self-assigned this Sep 4, 2017
sis0k0 added a commit that referenced this issue Sep 4, 2017
When a View is passed through the renderer on insert/remove it's patched
with ViewExtensions for its class. That is done for parent views and for
child views.

fixes #978
@sis0k0 sis0k0 added the renderer label Sep 7, 2017
sis0k0 added a commit that referenced this issue Sep 7, 2017
When a View is passed through the renderer on insert/remove it's patched
with ViewExtensions for its class. That is done for parent views and for
child views.

fixes #978
sis0k0 added a commit that referenced this issue Sep 7, 2017
refactor(renderer): invoke removeFromQueue for every element

refactor(action-bar): insert ActionItems at correct positions
ActionBar's insertChild method is now passed a next view argument. When the view to insert is an ActionItem, next is used to find the correct position to insert the new item.

refactor(renderer): patch every View with ViewExtensions
When a View is passed through the renderer on insert/remove it's patched
with ViewExtensions for its class. That is done for parent views and for
child views.

fixes #689, fixes #978
@ghost ghost removed the in progress label Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant