Skip to content

Commit

Permalink
Make sure extra function is not compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Oct 17, 2020
1 parent 9c2e235 commit 959c419
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/next/client/image.tsx
Expand Up @@ -183,14 +183,13 @@ export default function Image({
let thisEl: any

useEffect(() => {
if (!lazy) {
return () => {}
}
const observer = getObserver()
if (observer) {
observer.observe(thisEl)
return () => {
observer.unobserve(thisEl)
if (lazy) {
const observer = getObserver()
if (observer) {
observer.observe(thisEl)
return () => {
observer.unobserve(thisEl)
}
}
}
}, [thisEl, lazy])
Expand Down

0 comments on commit 959c419

Please sign in to comment.