adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.17k stars 1.06k forks source link

@react-stately/data : Cannot read properties of undefined (reading 'index') at useListState.ts #5817

Open Develekko opened 5 months ago

Develekko commented 5 months ago

Provide a general summary of the issue here

there's an issue on useListState.ts of @react-stately where im getting this error TypeError: Cannot read properties of undefined (reading 'index') at useListState.ts line:77

๐Ÿค” Expected Behavior?

no errors

๐Ÿ˜ฏ Current Behavior

im getting this error TypeError: Cannot read properties of undefined (reading 'index') at useListState.ts

๐Ÿ’ Possible Solution

  let index = Math.min(
    (
      diff > 1 ?
      Math.max(startItem?.index - diff + 1, 0) :
      startItem?.index
    ),
    itemNodes.length - 1);

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

  let index = Math.min(
    (
      diff > 1 ?
      Math.max(startItem?.index - diff + 1, 0) :
      startItem?.index
    ),
    itemNodes.length - 1);

Version

@react-stately/data v 3.11.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

windows

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

jsonMartin commented 5 months ago

I'm also having this issue

mayvagio2016 commented 3 months ago

same issue !

snowystinger commented 3 months ago

Does anyone have a reproduction that they can share? I'd like a test for this change if possible

CurryYangxx commented 3 months ago

Hi, we also having the same issue. https://github.com/Kong/insomnia/issues/7149. I found this error occurs from here through the error message and source code.

slimshreydy commented 2 weeks ago

Same issue here!