maciekgrzybek / svelte-inview

A Svelte action that monitors an element enters or leaves the viewport.🔥
MIT License
749 stars 23 forks source link

Uncaught TypeError: Cannot read property 'unobserveOnEnter' of undefined #9

Closed danawoodman closed 2 years ago

danawoodman commented 3 years ago

Hello!

I'm noticing the following error when the user scrolls out of focus for an item:

image

I don't have an on:leave event, code is basically:

<div use:inview on:enter={({ detail: { inView } }) => (isInView = inView)}>
  {#if isInView}
    Stuff here...
  {/if}
</div>

Using latest version.

Any idea why this is occurring?

maciekgrzybek commented 2 years ago

Hey thanks for creating the issue. It looks like a bug, I'll try to sort it out ASAP

maciekgrzybek commented 2 years ago

Hey @danawoodman this should be fixed in the newest version of this package 😊

danawoodman commented 2 years ago

Nice, thanks!