Skip to content
Source
Sign inSign up
TanStack/virtual

feat(react-virtual): compatibility with the React compiler #851

Closedgdorsi(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/851/headopened

Showing 2 changed files with 30 additions and 2 deletions.

x
0 of 2 viewed, 2 left
4 additions and 1 deletionpackages/react-virtual/src/index.tsxModified
View file
@@ -50,7 +50,10 @@
return instance._willUpdate()
})
​
- return instance
+ return React.useMemo(
+ () => Object.create(instance),
+ [instance.getVirtualItems()],
+ )
​
export function useVirtualizer<
26 additions and 1 deletionpackages/react-virtual/tests/index.test.tsxModified
View file
@@ -1,6 +1,6 @@
import { beforeEach, test, expect, vi } from 'vitest'
import * as React from 'react'
-import { render, screen, fireEvent } from '@testing-library/react'
+import { render, screen, fireEvent, renderHook } from '@testing-library/react'
​
import { useVirtualizer, Range } from '../src/index'
​