ResizeObserver polyfill for certain environments #367
Answered
by
tannerlinsley
RubenStoesser
asked this question in
Q&A
Replies: 1 comment
-
Pretty sure that falls on the application env, not ours.
Tanner Linsley
…On Aug 12, 2022, 2:18 AM -0600, RubenStoesser ***@***.***>, wrote:
In v3.0.0-beta.15 a PR was merged introducing the usage of ResizeObserver.
This works fine in modern browsers. However, it is causing some issues in test environments (e.g. Jest/JSDom) as ResizeObserver is not implemented there, so a polyfill is needed to get tests running. Without a polyfill every test will fail with:
ReferenceError: ResizeObserver is not defined
Your internal tests are passing because the default observeElementRect function which calls new ResizeObserver is overwritten in the useVirtualizer call within the test file.
My question is, do you see polyfilling of ResizeObserver functionality as a responsibility of package consumers or would you consider adding a polyfill directly within the package?
Cheers & thank you for the work on this great library!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RubenStoesser
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In v3.0.0-beta.15 a PR was merged introducing the usage of ResizeObserver.
This works fine in modern browsers. However, it is causing some issues in test environments (e.g. Jest/JSDom) as
ResizeObserver
is not implemented there, so a polyfill is needed to get tests running. Without a polyfill every test will fail with:Your internal tests are passing because the default
observeElementRect
function which callsnew ResizeObserver
is overwritten in theuseVirtualizer
call within the test file.My question is, do you see polyfilling of ResizeObserver functionality as a responsibility of package consumers or would you consider adding a polyfill directly within the package?
Cheers & thank you for the work on this great library!
Beta Was this translation helpful? Give feedback.
All reactions