Skip to content

v-if in action bar produces invalid state #76

@rigor789

Description

@rigor789

Using the following markup:

<action-bar title="test">
  <search-bar v-if="selectedTab === 0"></search-bar>
  <label v-else-if="selectedTab === 1" text="notifications"/>
  <label v-else text="DMS">
</action-bar>

When switching tabs the first change changes the action bar content properly, and then the following error is displayed:

ERROR: [Vue warn]: Error in nextTick: "Error: View not added to this instance. View: SearchBar(6) CurrentParent: undefined ExpectedParent: ActionBar(5)"

The error itself is thrown in NativeScript core: https://github.com/NativeScript/NativeScript/blob/f7a3a36b9cdd47042ce145de2e94af6eea63bba1/tns-core-modules/ui/core/view-base/view-base.ts#L504

A sample app reproducing the issue: https://play.nativescript.org/?template=play-vue&id=7i9dwtjHdw0Xh9sm13u_0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions