Skip to content

Cannot read $el of undefined with $refs.vsl for tabs  #173

Closed
@8BitJonny

Description

@8BitJonny

Basically this Bug again #57

The Bug is back.
I'm sadly not yet able to reproduce the bug within a jsfiddle but when we just imagine that this.$refs.vsl can be undefined then we notice that the current condition in line 271

offset = scrollelementRect.top - _elemRect.top;
} else {
offset = (vsl.$el || vsl).scrollTop || 0;
}

in onScroll will fail with the error Cannot read $el of undefined.

When we change the condition to be vsl ? (vsl.$el || vsl).scrollTop : 0; instead then it will successfully scroll back to the top even with no wrapper defined.

A bit more about my setup and more information about the cause

I basically have this setup in nuxt where I have a dynamic url which defines which filter on the list is applied: /inbox as url will show you all inbox items /all will show you all the items and so on.
Now I have a sidebar which lets me navigate between the views/urls via nuxt/vue router this.$router.push({ path: '/all' }). Now while switching back and forth I sometimes get this stacktrace https://imgur.com/a/jocKH2x with my parent component emitting beforeDestroy in between while this plugin is in his mounted function with a set offset but no vsl which leads to this error

I hope I could provide enough detail and maybe I try again to create this jsfiddle for you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions