-
-
Notifications
You must be signed in to change notification settings - Fork 818
Fix ResizeObserver being used in the List even when height is provided #855
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
bvaughn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. That's kind of an embarrassing oversight.
Mind doing the same change for Grid?
lib/components/list/List.test.tsx
Outdated
| window.ResizeObserver = vi.fn(() => ({ | ||
| observe: vi.fn(), | ||
| unobserve: vi.fn(), | ||
| disconnect: vi.fn() | ||
| })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| window.ResizeObserver = vi.fn(() => ({ | |
| observe: vi.fn(), | |
| unobserve: vi.fn(), | |
| disconnect: vi.fn() | |
| })); | |
| simulateUnsupportedEnvironmentForTest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure how this would work. From what I can see in the code, simulateUnsupportedEnvironmentForTest() sets the ResizeObserver to null. However, my goal here is to mock the object so that I can count executions, which is done at the end of the test with expect(window.ResizeObserver).toHaveBeenCalledTimes(0).
Sure, updated! |
|
Setting it to null means that the test would throw if resizeobserver is
even instantiated, which is a stronger guarantee that we don’t use the API
at all.
…On Fri, Sep 26, 2025 at 5:25 AM Tom Najdek ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/components/list/List.test.tsx
<#855 (comment)>:
> + window.ResizeObserver = vi.fn(() => ({
+ observe: vi.fn(),
+ unobserve: vi.fn(),
+ disconnect: vi.fn()
+ }));
I’m not sure how this would work. From what I can see in the code,
simulateUnsupportedEnvironmentForTest() sets the ResizeObserver to null.
However, my goal here is to mock the object so that I can count executions,
which is done at the end of the test with
expect(window.ResizeObserver).toHaveBeenCalledTimes(0).
—
Reply to this email directly, view it on GitHub
<#855 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHHHM6KCAIWDSOO5SS4EL3UUBAFAVCNFSM6AAAAACHP2ZP3SVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTENZRGE2DOOJUG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Fair point, updated! |
bvaughn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
|
Fix published in [email protected] |
The
styleprop isn’t properly forwarded fromListtouseVirtualizer, hence it’sundefinedhere and the subsequent early return fails. I wrote a quick test and a fix.