Nativescript-vue: Bug when re-opening the android app with the app icon.

Created on 9 Oct 2017  路  4Comments  路  Source: nativescript-vue/nativescript-vue

Steps to reproduce:

  1. If you open an app
  2. Close it with the Android back physical button
  3. Open it again through the app icon

Expected

The app opens normaly

Result

You get the error:

screen shot 2017-10-09 at 10 58 19

This error happened with both the Groceries Vue app and the ui-tests app.

bug help wanted

Most helpful comment

All 4 comments

I have same problem and you can fix that problem with this boiler plate way.

https://github.com/NativeScript/NativeScript/issues/4960~~

finally i found root of this problem.
what you see is only occurred at Vue cuz it reuse page if not destroyed using below code.
this is first clue.

    if (!prevVnode) {
      // initial render
      vm.$el = vm.__patch__(
        vm.$el, vnode, hydrating, false /* removeOnly */,
        vm.$options._parentElm,
        vm.$options._refElm
      );
    } else {
      // updates
      vm.$el = vm.__patch__(prevVnode, vnode);
    }

other example application doesn't make this problem but application context is not saved.
this is second clue.

if you [start application using auto sync -> home button -> start using app button -> back button] will make second activity.
this is last clue.

my conclusion is that [debug(auto syncing) app] and [run by app icon] doesn't use same activity.
if you add some condtion to if(!prevVnode) -> if(!prevVnode || true), your problem is disappeared.
it means [app icon activity try to getting Page's view] that owned by [debug activity Page's view].
it make [view already has a parent] error.
so it is not nativescript-vue's problem.
it just development side problem that not occurred at released application.

Just for reference here is the Activity lifecycle diagram, I think we need to implement android specific behavior (hook into the lifecycle) to handle resumed activities: https://developer.android.com/guide/components/activities/activity-lifecycle.html#alc

@blackss2
I tried with the release. But still bugs happen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jarden-liu picture jarden-liu  路  3Comments

keithgulbro picture keithgulbro  路  4Comments

farfromrefug picture farfromrefug  路  5Comments

MatheusPimentel picture MatheusPimentel  路  5Comments

kjlaw89 picture kjlaw89  路  3Comments