react-simple-infinite-scroll icon indicating copy to clipboard operation
react-simple-infinite-scroll copied to clipboard

Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null

Open hazirmagron opened this issue 6 years ago • 7 comments

Following the 'full example' I get this error once I scroll while the component where react-simple-infinite-scroll lies has been unmount.

I assume the error has to do with not removing the event listener to scroll - which should be done once the component containing the infinite scroll is unmounted. This seems to be coupled with how the sentinel object is handled, which is mentioned in the DOCS. It is unclear how it should be used, however.

This, to me, seems like a DOC issue if anything. I think this issue has been accounted for. It is just not properly communicated in the DOCS.

hazirmagron avatar Oct 09 '18 07:10 hazirmagron

Hi @hazirmagron

I'm guessing you downloaded the package from npm? If this is true, the problem you are talking about was fixed in https://github.com/jaredpalmer/react-simple-infinite-scroll/pull/1 but was never published to npm, current version in npm is the original version v0.0.1, a lot has changed since then. Let me know if I'm correct.

Either way we have to publish a new version of this module to npm. @jaredpalmer I vote for bumping up from 0.x to 1.0.0 due to the latest updates and then publish.

pgarciacamou avatar Oct 11 '18 06:10 pgarciacamou

Hi @pgarciacamou!

Yes, you're very much right. I did install it through npm. Makes sense how you communicated on the DOC then. Yes, update the npm version please. It is a very messy and annoying bug.

hazirmagron avatar Oct 12 '18 16:10 hazirmagron

@hazirmagron so, I had an idea (sorry in advance 🙉)

I honestly believe that @jaredpalmer is super busy with react itself so, what I would suggest is to fork this repo and install from git. This is what you would need to do:

  1. Fork this repo
  2. Clone the fork to your file system
  3. Remove lib from .gitignore: https://github.com/jaredpalmer/react-simple-infinite-scroll/blob/master/.gitignore#L2
  4. run yarn install && npm run build
  5. commit and push to your git fork (preferably to a descriptive branch like temp-fork)
  6. install in the repo you want to use this module via:
npm install --save username/repo#branch-name

# like:
npm install --save pgarciacamou/react-simple-infinite-scroll#temp-fork

Note that I haven't tried this and this is only a temporary solution, but Jared hasn't answered my messages so that is the best I've got.

Let me know if you have any questions.

pgarciacamou avatar Oct 14 '18 19:10 pgarciacamou

@pgarciacamou that worked for me, thanks 😄

davidsoderberg avatar Sep 09 '19 03:09 davidsoderberg

If anyone's interested, I published the fixed version of this package here: https://www.npmjs.com/package/react-simple-infinite-scroll-patched

iest avatar Sep 16 '19 20:09 iest

If anyone's interested, I published the fixed version of this package here: https://www.npmjs.com/package/react-simple-infinite-scroll-patched

@iest I tried your patch and I'm getting duplicate key issues, meaning that my queries aren't being throttled. I wasn't having this issue with v.0.0.1. Any ideas?

baleeds avatar Nov 13 '19 22:11 baleeds

It's because v0.0.2 includes this PR was merged in, but it's buggy.

baleeds avatar Nov 14 '19 14:11 baleeds