You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using swiper in nuxt. Sometimes I was getting the exception*:
Error: "TypeError: can't access property "removeEventListener", el[domMethod] is undefined"
The issue was that, when being initialized, swiper allows to be initialized for a class that doesn't exist yet in DOM without an exception. Then swiper can be mounted onto the element later.
this should be caught inside a vue component (perhaps, in swiper/vue, try/catch destroy inside onBeforeUnmount)
or if swiper/core should handle this case, as el can be a string before swiper is mounted.
There's a similar issue #4043, but it didn't say anything conclusive
* the exception happened because back button was clicked twice with suspense and for some reason nuxt didn't execute onMounted hook, but did call onBeforeUnmount, I couldn't create a reproduction. Probably similar issue
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello
I'm using swiper in nuxt. Sometimes I was getting the exception*:
The issue was that, when being initialized, swiper allows to be initialized for a class that doesn't exist yet in DOM without an exception. Then swiper can be mounted onto the element later.
When destroying, it only checks if swiper instance exists and isn't destroyed.
If swiper is never mounted,
el
is a string containing a class name or undefined. In this case destroy throws when unmounting events because el['removeEventListener'] is undefined.I'm not sure if
swiper/vue
, try/catch destroy inside onBeforeUnmount)swiper/core
should handle this case, asel
can be a string before swiper is mounted.There's a similar issue #4043, but it didn't say anything conclusive
* the exception happened because back button was clicked twice with suspense and for some reason nuxt didn't execute
onMounted
hook, but did callonBeforeUnmount
, I couldn't create a reproduction. Probably similar issuecodesandbox reproduction example
when html element exists
if element is deleted
Beta Was this translation helpful? Give feedback.
All reactions