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

Invalid keyframe value warning #581

Closed
elringus opened this issue Oct 23, 2023 · 5 comments
Closed

Invalid keyframe value warning #581

elringus opened this issue Oct 23, 2023 · 5 comments
Labels

Comments

@elringus
Copy link

After an update to the latest version of the react package I've started getting following warnings:

110391d71136843ed38fb79c509ffecc

af682f818939a5c181096b78bdb22e68

— I guess it should be an easy fix by just guarding against nan, but if you need a repro, I'll try to make one.

@KingSora
Copy link
Owner

KingSora commented Oct 24, 2023

@elringus Thanks for the report!

I'll create an fix, but out of curiosity I would like to know why the NaN value is created (probably division by 0 or something) but I can't trigger it in my tests.

@elringus
Copy link
Author

elringus commented Oct 24, 2023

Here's how I use the plugin:

export const Scrollable = (props: Props) => {
    const ref = useRef<HTMLDivElement>(null);
    const { children, scrollX, scrollY, container, className } = props;

    const [initialize, getInstance] = useOverlayScrollbars({
        options: {
            overflow: {
                x: scrollX == null ? "scroll" : scrollX ? "scroll" : "hidden",
                y: scrollY == null ? "scroll" : scrollY ? "scroll" : "hidden"
            },
            scrollbars: { clickScroll: true }
        },
        defer: false
    });

    useEffect(() => {
        if (ref.current != null) {
            if (container == null) initialize(ref.current);
            else initialize({ target: ref.current, elements: { viewport: container } });
        }
        return () => getInstance()?.destroy();
    }, [container, initialize, getInstance]);

    return <div {...props}
                ref={ref}
                children={children}
                className={c(css.scrollable, className)}
                data-overlayscrollbars=""/>;
};

I've noticed the warning is only triggered when I use the <Scrollable> for a virtual list (via virtuoso) and only when return () => getInstance()?.destroy(); is present. When the destructor is removed, the warning is gone (but also styling breaks, not sure why).

@elringus
Copy link
Author

Can confirm edc677f fixes the warnings.

I've tried making a minimal repro with just OverlayScrollbars and Virtuoso, but it didn't reproduce. It's probably more complicated.

@KingSora
Copy link
Owner

@elringus great! I'll publish a new version soon

@KingSora
Copy link
Owner

v2.4.4 is released and should fix this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants