Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'offset' of undefined #100

Closed
bryanhickerson opened this issue Oct 29, 2015 · 8 comments · Fixed by #145
Closed

Uncaught TypeError: Cannot read property 'offset' of undefined #100

bryanhickerson opened this issue Oct 29, 2015 · 8 comments · Fixed by #145

Comments

@bryanhickerson
Copy link

When I turn on destroyOnInfinity I get an exception in _checkIfInView after all the data has loaded and presumably the loader has been deleted. Everything is working fine since the data has already been loaded, but it seemed like there is something worth looking in to.

Exception:

Uncaught TypeError: Cannot read property 'offset' of undefined_checkIfInView @ infinity-loader.js:45

Line in question:

var selfOffset = this.$().offset().top;

Template:

{{resources-list resources=model}}
{{#infinity-loader infinityModel=model destroyOnInfinity=true}}
  <i class="fa fa-circle-o-notch fa-spin fa-2x" />
{{/infinity-loader}}
@davidgoli
Copy link
Collaborator

Thanks for filing the bug, I've seen this too, and the fix seems trivial. In my case I've removed the destroyOnInfinity property and handle hiding the infinity loader using CSS (the .reached-infinity class gets added to the .infinity-loader when infinity is reached.

👍 for a fix

@bryanhickerson
Copy link
Author

Thanks for the workaround

@hhff
Copy link
Collaborator

hhff commented Nov 12, 2015

thanks @bryanhickerson ! should be a simple fix! 👍 for this work around for now

@venkz
Copy link

venkz commented Feb 17, 2016

Hey I was not using the destroyOnInfinity flag but I still run into this issue when I run Ember test suite on pages that have infinity scroll. It is not reproducible consistently but I see this quite often.

Could you give me any clue as to why this occurs and what is happening here...

I updated to 0.2.1 V hoping it will fix the issue but no luck!

@bryanhickerson @davidgoli @hhff

@KennedyTedesco
Copy link

@venkz The same issue here. Even not using destroyOnInfinity the problem ocurs.

image

@ilucin
Copy link
Contributor

ilucin commented Mar 11, 2016

I have the same issue. It happens when component is destroying.
PR #138 is addressing this but I don't think it's doing the right think. It should check for this.isDestroying flag instead of this.isDestroyed.

@KennedyTedesco
Copy link

@ilucin 👍

@ilucin
Copy link
Contributor

ilucin commented Mar 11, 2016

Quick hack (until this gets resolved) is to reopen InfinityLoaderComponent and override _shouldLoadMore(). I did it in my project like this.

I've also created a PR #145 to fix this correctly.

@hhff hhff closed this as completed in #145 Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants