Random JavaScript error when navigating

@ldebeasi Getting a common problem when navigating from one screen to another in my Ionic Vue project. Occasionally, I’ll get the error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'classList')

Which points to at x (index.esm.js:1072):


Full stack trace:

x	@	index.esm.js:1072
async function (async)		
x	@	index.esm.js:1071
V	@	index.esm.js:1134
(anonymous)	@	index.esm.js:938
Oe	@	runtime-core.esm-bundler.js:154
Ze	@	runtime-core.esm-bundler.js:163
z	@	runtime-core.esm-bundler.js:2032
oa	@	runtime-core.esm-bundler.js:329
ha	@	runtime-core.esm-bundler.js:370
Promise.then (async)		
ta	@	runtime-core.esm-bundler.js:286
na	@	runtime-core.esm-bundler.js:308
ia	@	runtime-core.esm-bundler.js:311
M	@	runtime-core.esm-bundler.js:2060
v	@	reactivity.esm-bundler.js:183
y	@	reactivity.esm-bundler.js:189
scheduler	@	reactivity.esm-bundler.js:854
v	@	reactivity.esm-bundler.js:183
y	@	reactivity.esm-bundler.js:189
set value	@	reactivity.esm-bundler.js:764
F	@	vue-router.esm-bundler.js:3133
(anonymous)	@	vue-router.esm-bundler.js:3187
Promise.then (async)		
(anonymous)	@	vue-router.esm-bundler.js:3184
(anonymous)	@	vue-router.esm-bundler.js:441
o	@	vue-router.esm-bundler.js:440

This is all within the handlePageTransition method. Any ideas what is happening? I find that the transitions in my app are jittery sometimes but not sure it’s directly related to this.

Do you have a reproduction case I can run?

Let me see if I can take my existing project and strip out many of the views and see if the navigation still acts wonky.

@ldebeasi Here is a sample repo I created:

And here is a video showing it happen too:

I don’t know exactly what is causing it. It’s really just clicking around and mostly going into a detail view and then clicking back. Eventually it breaks and then it stays broken. The worst part is on native app it usually means you have to force quit.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'classList')

on line:


In ionic version 5.6.14, sometimes router I got that the similar errors too.

Can everyone test this again on Ionic Vue v5.8.5? We fixed a few bugs in that release related to routing.

1 Like

Will monitor Sentry and report back in a few days! Thanks!

1 Like

Hi @ldebeasi, I am already test and current does not see any errors. Thanks alot :grinning:

1 Like

I am still seeing it in v5.8.5. I’m trying to figure out if there is any consistency to it.

There doesn’t seem to be any consistency to it. I only see it happening when going to an IonPage from a tab and then clicking the IonBackButton but not always. Once it starts doing it, it seems to be consistent until I navigate to a different tab. It doesn’t completely break the app. Once navigating away to a different tab and back to where it was throwing the error, it no longer throws the error.

@ldebeasi I can confirm this still happens since we added Sentry to notify us. However, it doesn’t actually mess up the UI or do anything bad. Seems to error on navigating away from a screen. Oh well. Hopefully fixed in v6.

Can you file an issue on our GitHub repo with a sample app I can clone to reproduce the issue?

I’ve already provided a repo… (scroll up), but I’ll fill an issue on your repo.

1 Like

Pretty big bug IMO, been getting this randomly for a few versions now. Seems like routing needs to be re-written with so many bugs/anomalies in it.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘classList’)
at handlePageTransition (index.esm.js:1082)