ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: TypeError: Cannot read property 'index' of undefin

Open msevestre opened this issue 11 years ago • 11 comments

Type: bug

Platform: all

Version : 1.0.0-rc.0

I haven't found a way to reproduce systemically the issue. That's why no codepen is available.

But I managed to get the crash on ios, android and desktop

TypeError: Cannot read property 'index' of undefined
    at Object.IonicModule.factory.register (http://localhost:8100/lib/ionic/js/ionic.bundle.js:42182:44)
    at IonicModule.controller.self.register (http://localhost:8100/lib/ionic/js/ionic.bundle.js:47153:38)
    at updateView (http://localhost:8100/lib/ionic/js/ionic.bundle.js:52331:23)
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:52308:11
    at Scope.$get.Scope.$broadcast (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22639:28)
    at $state.transitionTo.$state.transition.resolved.then.$state.transition (http://localhost:8100/lib/ionic/js/ionic.bundle.js:40109:22)
    at processQueue (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21108:27)
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:21124:27
    at Scope.$get.Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22320:28)
    at Scope.$get.Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22136:31) undefined

The actual line in code is this one

hist.cursor = viewHistory.currentView.index;

Somehow, currentView is null and the index property is called resulting in the TypeError mentioned above.

msevestre avatar Mar 20 '15 02:03 msevestre

Dear @Ionitron,

If only your sensors were a bit more up-to-date, you would see that I mentioned in the text of the very issue that I was not able to replicate the issue for a robot like you.

The issue is there for sure, but appearing only occasionally.

If I find a step by step workflow allowing you to reproduce the bug, I will for sure create a codepen replicating the issue

Can you provide a detailed description of this issue?

Navigating in the application, I suddenly get the error described above. I have also attached the stack trace

How would a robot go about replicating this issue?

If I can figure how a human can replicate the issue, then I am pretty sure that I'll be able to answer that question

On which platform does this happen occur? (iOS, Android, all, etc.)

ALL (this was also mentioned in the issue... these sensors of yours definitely need some tune up)

On which platform versions does this occur? (Android 4.2, iOS 8, all, etc.)

Android 4.2, ios 7 and ios8. Chrome . I haven't tried anything else

Is this an issue with the Ionic Framework or Ionic CLI?

Ionic framework. I have also highlighted the actual line of code causing the bug

msevestre avatar Mar 20 '15 18:03 msevestre

Michael

http://interior-line.ru/vesrhina

20.03.2015, 22:00, "Michael Sevestre" [email protected]:Dear ,

If only your sensors were a bit more up-to-date, you would see that I mentioned in the text of the very issue that I was not able to replicate the issue for a robot like you.

The issue is there for sure, but appearing only occasionally.

If I find a step by step workflow allowing you to reproduce the bug, I will for sure create a codepen replicating the issue

Can you provide a detailed description of this issue?

Navigating in the application, I suddenly get the error described above. I have also attached the stack trace

How would a robot go about replicating this issue?

If I can figure how a human can replicate the issue, then I am pretty sure that I'll be able to answer that question

On which platform does this happen occur? (iOS, Android, all, etc.)

ALL (this was also mentioned in the issue... these sensors of yours definitely need some tune up)

On which platform versions does this occur? (Android 4.2, iOS 8, all, etc.)

Android 4.2, ios 7 and ios8. Chrome . I haven't tried anything else

Is this an issue with the Ionic Framework or Ionic CLI?

Ionic framework. I have also highlighted the actual line of code causing the bug

—Reply to this email directly or .

Fayozjon avatar Mar 24 '15 18:03 Fayozjon

Sorry, but if we can't reproduce the issue, we can't really fix it. We haven't seen it in any our tests, so it's likely there's an edge case in your app that we don't yet cover. Can you offer us any more info? Does your state config use resolves? Can you share your code with us so we can set up breakpoints? We need more info.

perrygovier avatar Mar 24 '15 19:03 perrygovier

I experienced this same bug as well. Produced the exact same call stack. It happened when I clicked a Tab Button. After correcting some bugs with Angular-Cache, I refreshed and haven't seen it ever since.

So yeah, @perrygovier there's no way to fix something you can't replicate. Just wanted to share my own experience because it may have nothing to do with ionic in particular.

odytrice avatar Apr 17 '15 20:04 odytrice

Greetings @msevestre!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Apr 23 '15 20:04 Ionitron

Greetings @msevestre!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Apr 23 '15 20:04 Ionitron

the bug has disappeared completely. Thanks

msevestre avatar Oct 06 '15 18:10 msevestre

I got a similar, also rarely reproducable error:

TypeError: Cannot read property 'index' of undefined
    at Object.register (ionic.bundle.js:51373)
    at self.register (ionic.bundle.js:56692)
    at updateView (ionic.bundle.js:62357)
    at ionic.bundle.js:62334
    at Scope.$broadcast (ionic.bundle.js:29477)
    at $state.transition.resolved.then.$state.transition (ionic.bundle.js:49321)
    at processQueue (ionic.bundle.js:27879)
    at ionic.bundle.js:27895
    at Scope.$eval (ionic.bundle.js:29158)
    at Scope.$digest (ionic.bundle.js:28969)(anonymous function) @ 

ionic.bundle.js:25642(anonymous function) @ ionic.bundle.js:22421Scope.$broadcast @ 
ionic.bundle.js:29479$state.transition.resolved.then.$state.transition @ 
ionic.bundle.js:49321processQueue @ ionic.bundle.js:27879(anonymous function) @ 
ionic.bundle.js:27895Scope.$eval @ ionic.bundle.js:29158Scope.$digest @ 
ionic.bundle.js:28969Scope.$apply @ ionic.bundle.js:29263(anonymous function) @ 
ionic.bundle.js:25398eventHandler @ ionic.bundle.js:16583triggerMouseEvent @ 
ionic.bundle.js:2948tapClick @ ionic.bundle.js:2937tapTouchEnd @ ionic.bundle.js:3064

My setup contains some views, one side-menu pointing to the views, and a tab control on one of the views.

I get this issue rarely - but sometimes when i navigate between the views using the sidemenu. Interestingly: When the error occurs once, it seems to get fired every time I switch views, until I reload the app.

It points to the same line as in the initial post: hist.cursor = viewHistory.currentView.index;

Does your state config use resolves?

Most of my views use one or multiple resolves.

I'm sorry I'm not able to provide more information on this, I think, since It's also hard to reproduce it for me. I will try to do some debugging when it occurs next.

Screeze avatar Feb 27 '16 21:02 Screeze

@Screeze +1 I don't use resolves

blablapolicja avatar Apr 06 '16 15:04 blablapolicja

I get this error, too, occasionally.
hist.cursor = viewHistory.currentView.index;

Trying to replicate is proving to be hard.

corey-garvin avatar May 11 '16 21:05 corey-garvin

I have exactly the same problem on Ionic 1.3.1

ionic.bundle.js:26794 TypeError: Cannot read property 'viewId' of undefined
    at Object.register (http://localhost:8100/lib/ionic/js/ionic.bundle.js:54185:30)
    at self.register (http://localhost:8100/lib/ionic/js/ionic.bundle.js:59708:38)
    at updateView (http://localhost:8100/lib/ionic/js/ionic.bundle.js:65398:23)
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:65375:11
    at Scope.$broadcast (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30718:28)
    at $state.transition.resolved.then.$state.transition (http://localhost:8100/lib/ionic/js/ionic.bundle.js:52157:22)
    at processQueue (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29127:28)
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:29143:27
    at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30395:28)
    at Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30211:31) undefined

It happens when I quickly click on tab links, I'm wondering if I'm not triggering two state changes at the same time?

thibaultponcelet avatar Jul 07 '16 13:07 thibaultponcelet