vue-infinite-loading icon indicating copy to clipboard operation
vue-infinite-loading copied to clipboard

TypeError: Cannot read property '_infiniteScrollHeight' of null

Open kvanska opened this issue 6 years ago • 11 comments

2.4.4

Vue.js version 2.6.10

Nuxt.js version 2.8

Steps to reproduce

When loading page without infinite-loading control and then navigatin to another page (SPA) that has infinite-loading, getting exception "TypeError: Cannot read property '_infiniteScrollHeight' of null"

What is Expected?

no exception

What is actually happening?

getScrollParent function recursively finds the parent element and for some reason when loading in SPA, parent node is null for:

on page refresh it's not null and parent is set to window

here it's said that

".... if all failed, the component will use window as the scroll container."

In this case it clearly fails but window is not set as the scroll container.

kvanska avatar Jun 27 '19 10:06 kvanska

I hit this problem - thanks for the fix. Any chance of doing a release soon that includes this?

edwh avatar Jan 17 '20 23:01 edwh

I hit this problem too, @PeachScript - anything we can do to help push this change?

Frozire avatar Jan 22 '20 13:01 Frozire

Same problem here

nicolashmln avatar Mar 12 '20 03:03 nicolashmln

same problem

jawn-ha avatar Mar 31 '20 01:03 jawn-ha

Hi, I have the same problem. Is there any chance that #255 will be merged soon?

jankaderabek avatar Oct 07 '20 07:10 jankaderabek

I needed this fix too. For the time being I was using kuroskis forked repository with fix, but he deleted it. I created new forked repo with this fix #255 Feel free to rewrite your package.json dependencies to "vue-infinite-loading": "https://github.com/DomcaSuzi/vue-infinite-loading".

DomcaSuzi avatar Oct 20 '20 11:10 DomcaSuzi

I hit this problem - thanks for the fix. Any chance of doing a release soon that includes this?

Too many requests for this props force-use-infinite-wrapper="body"

phyzerbert avatar Oct 31 '20 14:10 phyzerbert

@phyzerbert thanks! this solved it for me 🎉

andreasvirkus avatar Apr 08 '21 13:04 andreasvirkus

@andreasvirkus What do you mean this solved it for me ?
you shouldn't use force-use-infinite-wrapper="body", it is the wrong way.

iulo avatar May 19 '21 11:05 iulo

@iulo why is it the wrong way? It didn't degrade performance, didn't cause any extra bugs and solved the annoying errors. Checked all my boxes 🤷‍♀️ 🙊

andreasvirkus avatar May 24 '21 12:05 andreasvirkus

@andreasvirkus when you set force-use-infinite-wrapper="body", ths scrollParent will set to body element, not the window. https://github.com/PeachScript/vue-infinite-loading/blob/4baed2bb078f076d3bff48c783ed324236630ed6/src/components/InfiniteLoading.vue#L318-L324

then getCurrentDistance will always return a number <=0 https://github.com/PeachScript/vue-infinite-loading/blob/4baed2bb078f076d3bff48c783ed324236630ed6/src/components/InfiniteLoading.vue#L292-L306

so the loading behavior will be triggered all the time until it is completed which I think it's not what you expected.

Try the demo below to see what happens. https://codepen.io/iulo/pen/xxqrzrZ

iulo avatar May 26 '21 03:05 iulo