KingSora / OverlayScrollbars

A javascript scrollbar plugin that hides the native scrollbars, provides custom styleable overlay scrollbars, and preserves the native functionality and feel.
https://kingsora.github.io/OverlayScrollbars
MIT License
3.71k stars 215 forks source link

Error caused when routing #627

Closed LynithDev closed 3 months ago

LynithDev commented 3 months ago

Describe the bug Whenever I switch pages using solid-router, I start getting errors with OverlayScrollbars,

[Error] Unhandled Promise Rejection: TypeError: null is not an object (evaluating 'S.top')
    (anonymous function) (overlayscrollbars.mjs:2367)

The source file and location it occurs at is in structureSetup.elements.ts:276

To Reproduce Steps to reproduce the behavior:

  1. Switch to a different page
  2. Switch to the previous page
  3. Scrollbar doesn't show up and throws an error

Expected behavior No errors get thrown and the scrollbar displays and handles user interaction properly.

Environment

KingSora commented 3 months ago

Good day @LynithDev :)

I've found the issue - document.defaultView can be null and I'm not accounting for this. I'm not sure when this happens and this is actually the first environment where I can observe this.

I'll publish a fix soon - sorry for the inconvenience

LynithDev commented 3 months ago

No worries, the library is fairly simple to use and mostly just works. I appreciate the work :+1:

KingSora commented 3 months ago

@LynithDev I've published OverlayScrollbars v2.7.2 which should fix your issue :)

LynithDev commented 3 months ago

I'll try it later today, thanks :+1:

LynithDev commented 3 months ago

Can confirm that it has fixed the issue.