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

Cannot read properties of null (reading 'getBoundingClientRect') #75

Open
leekung opened this issue Aug 31, 2023 · 3 comments
Open

Cannot read properties of null (reading 'getBoundingClientRect') #75

leekung opened this issue Aug 31, 2023 · 3 comments

Comments

@leekung
Copy link

leekung commented Aug 31, 2023

I got this error on production build website
Sentry stack trace show me that the error is from this package

Screenshot 2023-08-31 at 22 23 48

I don't know why element is null, maybe we have to check

function isVisible(el: Element, view: Element | null): boolean {
  if (!el) return false; //<-- maybe we add this to prevent error
  const elRect = el.getBoundingClientRect();
  if (!view) return elRect.top >= 0 && elRect.bottom <= window.innerHeight;
  const viewRect = view.getBoundingClientRect();
  return elRect.top >= viewRect.top && elRect.bottom <= viewRect.bottom;
}
@SpiritusDeos
Copy link

I have the same issue

2 similar comments
@Oliwer-Budnik
Copy link

I have the same issue

@fiamma06
Copy link

I have the same issue

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

No branches or pull requests

4 participants