Akryum / vue-virtual-scroller

⚡️ Blazing fast scrolling for any amount of data
https://vue-virtual-scroller-demo.netlify.app
9.36k stars 896 forks source link

Lib crash if I use a different key than id and the id is null #758

Closed dragos-boisteanu closed 1 year ago

dragos-boisteanu commented 1 year ago

Describe the bug

If I have a list of objects that have 2 keys like {id: null, seq: 1234} and set key-field to 'seq' the lib will crash saying there is no 'seq' field on the internal item object.

Some screenshotos from Edge debuger image image image image

Reproduction

Here is a repo to test https://github.com/dragos-boisteanu/scroller-issue

If you change the id to id: i and remove key-field or set it to 'id' it will work

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 AMD Ryzen 5 5600H with Radeon Graphics
    Memory: 1.29 GB / 15.36 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (106.0.1370.47)
    Internet Explorer: 11.0.22000.120

"dependencies": {
    "core-js": "^3.8.3",
    "vue": "^2.6.14",
    "vue-virtual-scroller": "^1.1.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "sass": "^1.32.7",
    "sass-loader": "^12.0.0",
    "vue-template-compiler": "^2.6.14"
  }

Used Package Manager

pnpm

Validations

zhangpf1127 commented 1 year ago

+1