Bottombar - Error: Uncaught (in promise): Current componentRef is different for cached componentRef / Cannot read property 'componentRef' of undefined

nativescriptrocks
plugins

#1

Hi,

In Bottombar(Nativescript-bottombar), i tried to navigate different components based on menus in bottombar.

Navigation code -

 tabSelected(args: SelectedIndexChangedEventData) {
switch(args.newIndex){
case 1:
this.router.navigate(["/ipfresults"]);
break;   
case 2:   
this.router.navigate(["/ifindings"]);
break;    
       }}

After the main page loading, the bottombar menus navigation works fine for first time. Once i comeback to main page, Afterwards navigate to further menus not working.

Back option code to main page,

public goBack() {
    this.routerExtensions.back();
        // this.routerExtensions.backToPreviousPage();
}

And while try to select each menus again its throws follows error.

Error console 1 -


JS: 2
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'componentRef' of undefined
JS: TypeError: Cannot read property 'componentRef' of undefined
JS:     at PageRouterOutlet.deactivate (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/nat
ivescript-angular/router/page-router-outlet.js:104:39)
JS:     at ActivateRoutes.deactiveRouteAndOutlet (file:///data/data/org.nativescript.IFSapp/files/app/tns_m
odules/@angular/router/bundles/router.umd.js:4578:20)
JS:     at ActivateRoutes.deactiveRouteAndItsChildren (file:///data/data/org.nativescript.IFSapp/files/app/
tns_modules/@angular/router/bundles/router.umd.js:4538:18)
JS:     at ActivateRoutes.deactivateRoutes (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules
/@angular/router/bundles/router.umd.js:4467:22)
JS:     at file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angular/router/bundles/router.u
md.js:4429:19
JS:     at Array.forEach (native)
JS:     at ActivateRoutes.deactivateChildRoutes (file:///data/data/org.nativescript.IFSapp/files/app/tns_mo
dules/@angular/router/bundles/router.umd.js:4428:29)
JS:     at ActivateRoutes.activate (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angula
r/router/bundles/router.umd.js:4415:14)
JS:     at file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angular/router/bundles/router.u
md.js:4034:22
JS:     at SafeSubscriber._next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Obser
vable.js:110:21)
JS:     at SafeSubscriber.__tryOrSetError (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/
rxjs/Subscriber.js:247:16)
JS:     at SafeSubscriber.next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscr
iber.js:187:27)
JS:     at Subscriber._next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscribe
r.js:125:26)
JS:     at Subscriber.next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscriber
.js:89:18)
JS:     at MapSubscriber._next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/operat
or/map.js:83:26)

Error console - 2

JS: 2
JS: ERROR Error: Uncaught (in promise): Error: Current componentRef is different for cached componentRef
JS: Error: Current componentRef is different for cached componentRef
JS:     at PageRouterOutlet.deactivate (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/nat
ivescript-angular/router/page-router-outlet.js:106:23) [angular]
JS:     at ActivateRoutes.deactiveRouteAndOutlet (file:///data/data/org.nativescript.IFSapp/files/app/tns_m
odules/@angular/router/bundles/router.umd.js:4578:20) [angular]
JS:     at ActivateRoutes.deactiveRouteAndItsChildren (file:///data/data/org.nativescript.IFSapp/files/app/
tns_modules/@angular/router/bundles/router.umd.js:4538:18) [angular]
JS:     at ActivateRoutes.deactivateRoutes (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules
/@angular/router/bundles/router.umd.js:4467:22) [angular]
JS:     at file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angular/router/bundles/router.u
md.js:4429:19 [angular]
JS:     at Array.forEach (native) [angular]
JS:     at ActivateRoutes.deactivateChildRoutes (file:///data/data/org.nativescript.IFSapp/files/app/tns_mo
dules/@angular/router/bundles/router.umd.js:4428:29) [angular]
JS:     at ActivateRoutes.activate (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angula
r/router/bundles/router.umd.js:4415:14) [angular]
JS:     at file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/@angular/router/bundles/router.u
md.js:4034:22 [angular]
JS:     at SafeSubscriber._next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Obser
vable.js:110:21) [angular]
JS:     at SafeSubscriber.__tryOrSetError (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/
rxjs/Subscriber.js:247:16) [angular]
JS:     at SafeSubscriber.next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscr
iber.js:187:27) [angular]
JS:     at Subscriber._next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscribe
r.js:125:26) [angular]
JS:     at Subscriber.next (file:///data/data/org.nativescript.IFSapp/files/app/tns_modules/rxjs/Subscriber
.js:89:18) [angular]

Why its happening? Please suggest!!!

Thanks in advance…


#2

If once this issue happens then rest navigations/options throughout the app are not working. Only physical device’s navigation options are working.
Once i killed the app and started again then its working again issue happens.