question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes when "list" is changed in VirtuosoGrid

See original GitHub issue

first off, this library is great and exactly what I need!

I am using the VirtuosoGrid component, I supply it an array of small objects (from redux). I am trying to allow a user to use a text input to search and filter the boxes in the grid, so I have the text input text filter the array that is passed to this grid, when the list is “filtered” my react app crashes because a component that did have one of the “items” is now getting undefined.

I’m probably missing something simple. But it seems like this should just work?

// user typed in "mi"
const searchText = 'z';
const list = [{a: 'Mike'}, {a: 'Sam'}....... {a: 'Michael'}];

// some logic to filter the list based on text input
const filteredList = list.filter(item => item.a === searchText);

// down way below in renderland
<VirtuosoGrid
  totalCount={filteredList.length}
  item={idx => <MyComponent item={filteredList[idx]} />}
/>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
petyosicommented, Jul 31, 2019

Thank you! Reproduced the problem on my side, confirming it as a bug. Will figure out a fix and publish a new version this week.

1reaction
petyosicommented, Jul 31, 2019

Hey, @mcabs3 that should work from what I see, but you may have found a bug in the rendering mechanism. Can you reproduce it in stackblitz or codesandbox? I will take a look.

Cheers,

Read more comments on GitHub >

github_iconTop Results From Across the Web

[UWP] ListViews crashing app when data is updated - MSDN
If I give the data time to update before navigating to the list page everything is fine, and the new data is shown...
Read more >
Troubleshooting React Virtuoso
List is jumping around or misbehaving#. The list relies on measuring the item sizes and dynamically updating its position based on the received...
Read more >
react-virtuoso - Bountysource
I'm currently using the VirtuosoGrid component to render a long list of items ... you can now reset endReached by change the object...
Read more >
when data is changed in real time database(firebase) app ...
Try this method, it worked for me FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.
Read more >
Why is my React app crashing when changing an input?
330K subscribers in the reactjs community. A community for learning and developing web applications using React by Facebook.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found