Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualScroller.scrollToIndex programming error #1610

Closed
nclemeur opened this issue Sep 27, 2021 · 3 comments
Closed

VirtualScroller.scrollToIndex programming error #1610

nclemeur opened this issue Sep 27, 2021 · 3 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@nclemeur
Copy link

[x] bug report

I am encountering some issues in my attemps to use the VirtualScroller within an autocomplete (see #1597, #1601), but one ovious bug in the code is highlighted in the screenshot below: on line 394, the this.first state will be set to undefined as the local variable newFirst is a simple integer. This leads subsequently to some strange behaviour in that component

image

@tugcekucukoglu
Copy link
Member

How can I replicate this? Issue is not clear, please add a codesandbox sample when you create a new issue.

@nclemeur
Copy link
Author

nclemeur commented Oct 5, 2021

I'll try to make a reproduction of this issue, but you need to manually call scrollToIndex to see the problem

Having said that the problem is really obvious and it should be a no brainer to fix it: newFirst is calculated using the function calculateFirst which return a simple primitive int value, so doing newFirst.index is wrong, it should simply be this.first= newFirst

@nclemeur
Copy link
Author

nclemeur commented Oct 7, 2021

I have spend quite a bit of time to setup an example that can illustrate the issue, but the example is a bit convoluted. Having said that the bug is so obvious that again it should not need this kind of example. So if you open https://codesandbox.io/s/lazy-loader-bug-ld4lu?file=/src/AutoCompleteDemo.vue.

To see the issue, simply open the dropdown, scroll to any position, then click on button "To Index 100". This will work fine, but if you don't scroll anymore and click again on the button, you'll be scrolled back to somewhere closed to the top...

I believe the fix is either to completely remove the line 394 (highlighted in yellow above) an leaving the responsibility of setting this.first to the method onScrollChange, or at least to change it to this.first = newFirst

@tugcekucukoglu tugcekucukoglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Oct 12, 2021
@tugcekucukoglu tugcekucukoglu added this to the 3.8.1 milestone Oct 12, 2021
@tugcekucukoglu tugcekucukoglu self-assigned this Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants