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.

Several issues when filtering list from long to shorter (or short to longer)

See original GitHub issue

Bug Report

Describe the Bug

Displaying a short list (81 entries) after a long list (830 entries) skips all but two (or a few) entries of shorter list and introduces excess free space before items displayed. resetScroll is enabled and itemCount managed as local state. This only happens when first (longer) list was scrolled down for a few pages.

How to Reproduce

Usage:

  const [itemCount, setItemCount] = React.useState(entries.length)
  const { outerRef, innerRef, items, scrollToItem } = useVirtual({
    itemCount,
    resetScroll: true
  })

  React.useEffect(() => {
    setItemCount(entries.length)
  }, [entries])

CodeSandbox Link

I’m working on a CodeSandbox which reproduces this behavior. This will take a few days.

Expected Behavior

Second (shorter) list is displayed with first entry at the top (provided resetScroll is working as intended).

Screenshots

Screenshot 2021-09-08 at 19 53 05

Your Environment

  • MacBook Pro (15-inch, 2017)
  • macOS 11.5.2 (Big Sur)
  • Electron 13.1.6
process.versions = {
  "node": "14.16.0",
  "v8": "9.1.269.36-electron.0",
  "uv": "1.40.0",
  "zlib": "1.2.11",
  "brotli": "1.0.9",
  "ares": "1.16.1",
  "modules": "89",
  "nghttp2": "1.41.0",
  "napi": "7",
  "llhttp": "2.1.3",
  "openssl": "1.1.1",
  "icu": "68.1",
  "unicode": "13.0",
  "electron": "13.1.6",
  "chrome": "91.0.4472.124"
}

Additional Information

N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dehmercommented, Sep 12, 2021

@wellyshen Thank you! Looks good so far. We will test extensively in the coming days. Fingers crossed! 🤞

1reaction
dehmercommented, Sep 10, 2021

Yes. I slightly modified https://codesandbox.io/s/cocky-microservice-45702

Try this to reproduce issue 2:

  1. filter: type ‘4c’
  2. filter: cut ‘4c’
  3. scroll to list bottom with cursor down key
  4. filter: paste ‘4c’
  5. filter: cut ‘4c’ expected: list shows some 80 entries actual: list shows only 7 entries
Read more comments on GitHub >

github_iconTop Results From Across the Web

excel, filter drop window too small - Microsoft Community Hub
I use a DELL XPS with 4K monitor and I have the following issue. When I open the drop down window on a...
Read more >
Excel filtering very slow - Super User
It takes around 5 seconds to filter any column for any keyword. Which is pretty long because this sheet gets filtered a lot...
Read more >
How to Filter a List in Python? - Finxter
All elements that are smaller than 10 and larger than 0 are included in the filtered list. Thus, only one element 3 remains....
Read more >
Filter a list of items from a long long list | wmfexcel
If you need to filter for a list of items (strings) regardless position in the source data, i.e. partial match, you may use...
Read more >
Longer object length is not a multiple of shorter object length?
Yes, this is something that you should worry about. Check the length of your objects with nrow(). R can auto-replicate objects so that...
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