Skip to content

[React Aria] [Virtualizer] [Nested components] Maximum call stack size exceeded #8140

Closed
@kaitoukid-1412

Description

@kaitoukid-1412

Provide a general summary of the issue here

Virtualizer1
Image

Virtualizer2
Image

CodeSandbox
https://codesandbox.io/p/sandbox/c27jpz?file=%2Fsrc%2FApp.js%3A94%2C23

// https://react-spectrum.adobe.com/react-aria/Virtualizer.html

import { useId } from 'react'
import {
  GridLayout,
  ListBox,
  ListBoxItem,
  ListLayout,
  Size,
  Virtualizer as V
} from 'react-aria-components'

const layouts = {
  grid: GridLayout,
  list: ListLayout
}

export const Virtualizer = ({
  children,
  gap,
  items,
  itemSize,
  itemStyle,
  layout
}) => {
  const id = useId()

  return (
    <div style={{ maxWidth: '100%', overflow: 'hidden', resize: 'both' }}>
      <V
        layout={layouts[layout]}
        layoutOptions={{
          gap,
          minItemSize: new Size(itemSize.width, itemSize.height),
          minSpace: new Size(gap, gap)
        }}>
        <ListBox
          aria-labelledby={id}
          className='size-full'
          items={items.map((item, id) => ({ id: id.toString(), ...item }))}
          layout={layout === 'list' ? undefined : layout}
          style={{ overflow: 'auto' }}>
          {item => (
            <ListBoxItem
              style={{ ...itemStyle, ...itemSize }}
              textValue={item.id}>
              {children(item)}
            </ListBoxItem>
          )}
        </ListBox>
      </V>
    </div>
  )
}

🤔 Expected Behavior?

`

😯 Current Behavior

`

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

`

Version

1.8.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

W11

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions