question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Custom Scroller no longer works after upgrading to v2.3.2, main demo site example also appears broken

See original GitHub issue

Describe the bug List renders first page of items but fails to load more. See the example on virtuoso.dev site, here

Desktop (please complete the following information): MacBook Pro (13-inch, M1, 2020) MacOS Monterey 12.0.1 Chrome v97

Had to roll back my version to 2.3.1 to get it working again. Any idea what’s going on? Below is my implementation of custom scrollbars that work < v2.3.1.

import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';

const CustomScrollbars = React.forwardRef(({ children, style, ...props }, ref) => {

  const refSetter = useCallback((scrollbarsRef) => {
    if (scrollbarsRef) {
      ref.current = scrollbarsRef.osInstance().getElements().viewport;
    }
  }, [ref]);
  
  return (
    <OverlayScrollbarsComponent
      ref={refSetter}
      options={{ overflowBehavior: { x: 'hidden' } }}
      style={style}
      {...props}
    >
      {children}
    </OverlayScrollbarsComponent>
  );
});

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
maxhelselcommented, Jan 26, 2022

Yes, that’s it. For anyone who stumbles upon this in the future, here’s what I did to fix the OverlayScrollbars component to get it working > v2.3.2 again.

Here’s the props that need to be injected post v2.3.2:

data-test-id="virtuoso-scroller"
data-virtuoso-scroller="true"
tabindex="0"

However, simply passing {…props} into the OverlayScrollbarsComponent does not work, as they end up injecting into the wrapper - not the internal scroll container itself. To fix, I looped the props passed from Virtuoso and injected them into the scroll element.

const CustomScrollbars = React.forwardRef(({ style, children, ...props }, ref) => {

  const refSetter = useCallback((scrollbarsRef) => {
    if (scrollbarsRef) {
      let customViewport = scrollbarsRef.osInstance().getElements().viewport;
      for (const key in props) {
        if (!props.hasOwnProperty(key)) {
          continue;
        }
        customViewport.setAttribute(key, props[key])
      }
      ref.current = customViewport;
    }
  }, [ref]);

  return (
    <OverlayScrollbarsComponent
      ref={refSetter}
      style={{ ...style }}
    >
      {children}
    </OverlayScrollbarsComponent>
  );
});

The above props get passed as attributes into the scroll container using the described method.

1reaction
paulm17commented, Dec 18, 2022

@maxhelsel Thanks so much for following up. Appreciate it. I too am running nextjs and my code is similar to yours (exactly as the sandbox).

Edit: Switched to using your code as GroupedVirtuoso wouldn’t take the scroller component. I’m using VirtuosoGrid, Virtuoso and GroupedVirtuoso in this app. 😄

I have noticed that if I update either dependencies

overlayscrollbars-react to 0.4.0 - it breaks overlayscrollbars to 2.0.0-beta.0 - it breaks

For now I’m content with running an older version. Once I finish the project I’m working on, then I’ll circle back and try to work out why later versions break.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Known Bugs and User Experience Issues - Elementor
Learn everything about Known Bugs and User Experience Issues in this article from Elementor's Knowledge Base. Get Elementor tips & more.
Read more >
Known Bugs & Issues - Documentation - OceanWP
In this document we'll cover known bugs or user experience issues related to specific updates, as well as the current status (example: fixed ......
Read more >
MainStage release notes - Apple Support
The main volume slider no longer reverts to its previous value if it is adjusted and then the background of the Channel Strips...
Read more >
Bootstrap Modal Issue - Scrolling Gets Disabled - Stack Overflow
Bootstrap doesn't support multiple modals on the same page (At least until BS3). One way to make it work, is to use the...
Read more >
Changelog - ACF
Changelog. Proudly improving Advanced Custom Fields since 1.0.0. 6.0.6. Release Date 13th December 2022.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found