-
-
Notifications
You must be signed in to change notification settings - Fork 235
Closed as not planned
Description
Describe the bug
It's not exactly a bug on the library itself, rather a request for stronger verification.
Context:
I'm developing a widget, that is embedded into many different CMSs. There is one in particular, that has the following code:
if (!window.requestIdleCallback) {
window.requestIdleCallback = (cb) => {
setTimeout(cb, 0);
}
}It does not implement the interface correctly, and does not implement the cancel feature at all.
This does the following to OverlayScrollbars at this point:
- Assume the browser does not natively support
requestIdleCallback idleSupportedbecomestruesincewnd.requestIdleCallbackis a functioncIdlebecomesundefinedsincecancelIdleCallbackis not implemented- the app crashes when
cIdleis called (when the UI is destroyed)
To Reproduce
- Inject the above code before creating a scrollbars component
- Create a scrollbars component
- Destroy the component
- Crash happens
Environment
- OverlayScrollbars version:
overlayscrollbars: 2.11.5
overlayscrollbars-react: 0.5.6
- Used Operating System(s): MacOS, IOS (any)
- Used Browser(s) (with version): Safari (any) / IOS Safari (any)
Additional context
This is more of a workaround request than a bug report. What I'd like to ask is, when idleSupported is being set, either:
- Also check that
typeof wnd.cancelIdleCallback === 'function'(minimal solution) - Verify that
window.requestIdleCallbackis native code, perhaps byrequestIdleCallback.toString() .includes('[native code]')(Imo more robust solution)
I'd be happy to contribute too, if you are okay with one of the above suggestions ...?
I know that this is not something that your library should have to do, so thank you for considering it!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels