Aljullu / react-lazy-load-image-component

React Component to lazy load images and components using a HOC to track window scroll position.
https://www.npmjs.com/package/react-lazy-load-image-component
MIT License
1.44k stars 109 forks source link

IntersectionObserver.unobserve: Argument 1 is not an object. #114

Closed crisboarna closed 1 year ago

crisboarna commented 1 year ago

Bug description When the LazyLoadImage component is used in a component that is not visible in the window, the componentWillUnmount lifecycle method is called by React on it. If I do not scroll down to have it become visible and instead perform a navigation to a different page, the componentWillUnmount is called again, at which point this.placeholder is null (see screenshot, I added console.log at line 54 in resulting in src/components/PlaceholderWithoutTracking.jsx)

Uncaught TypeError: IntersectionObserver.unobserve: Argument 1 is not an object.

To Reproduce Paste the code that is producing the issue

<LazyLoadImage
              key={idx}
              src={tool.image}
              alt={tool.name}
              effect={'blur'}
            />

Expected behavior Navigation to next page to happen without error.

Screenshots CleanShot 2022-11-07 at 14 04 32@2x

Technical details: