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 triggers onLazyLoad event even though there is no scroll event. #11987

Closed
bnymncoskuner opened this issue Sep 28, 2022 · 11 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@bnymncoskuner
Copy link

Describe the bug

VirtualScroller triggers onLazyLoad event even though there is no scroll event.

You can view the console on this demo

Open up the console and you will see the event being logged constantly.

Environment

Simple angular project with latest version of angular and primeng

Reproducer

https://stackblitz.com/edit/primeng-virtualscroller-demo-cqpv7h

Angular version

14.2.3

PrimeNG version

14.1.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.14.2

Browser(s)

No response

Steps to reproduce the behavior

  1. Open up the console
  2. You'll see the event being logged constantly.

Expected behavior

I would expect the lazyLoad event to trigger when there is a scroll event.

@bnymncoskuner bnymncoskuner added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Sep 28, 2022
@yelhouti
Copy link
Contributor

Is this a regression ? I am facing the same issue in dropdowns, the same event shouldn't be triggered twice

@yelhouti
Copy link
Contributor

@mertsincan I see that you are the one who worked on VirtualScoll. It is complitelly broken when lazy, specifically when working with dropdowns.
Even the primeng demo is broken...

@cetincakiroglu cetincakiroglu self-assigned this Sep 30, 2022
@cetincakiroglu cetincakiroglu added this to the 14.1.3 milestone Sep 30, 2022
@cetincakiroglu
Copy link
Contributor

Hi,

Thanks for reporting the issue, I added it to the milestone

@mnhock
Copy link

mnhock commented Sep 30, 2022

We have the same issue triggering endless events for virtual scroll / lazyload mode in p-dialog component.

@yelhouti
Copy link
Contributor

@mnhock I am working on a PR that also fixes lazy to work with filters

@mnhock
Copy link

mnhock commented Sep 30, 2022

Thank you so much @yelhouti ! I appreciate the work of your guys!

@yelhouti
Copy link
Contributor

@mnhock I am just a user of the library like you :)

@yelhouti
Copy link
Contributor

@mnhock for the dropdown, the issue was because of a scroll that triggered the reload, I suspect the same thing happens in your component. I am fixing dropdown and multiselect for now

@yelhouti
Copy link
Contributor

yelhouti commented Sep 30, 2022

@cetincakiroglu could you check the PR please, Also I an unable to run ng build locally:

Debug Failure. False expression: Non-string value passed to ts.resolveTypeReferenceDirective, likely by a wrapping package working with an outdated resolveTypeReferenceDirectives signature. This is probably not a problem in TS itself.

It seems like an issue witch package versions, could you please tell the node version you are using? and also can you ensure that when you remove node_modules and reinstall it keeps building.

Thanks in advance

Edit: fixed by updating ng-package to match angular version pushed that too

@ThorstenKunz
Copy link

ThorstenKunz commented Oct 21, 2022

Same thing happens to us with p-table when used with virtualscroll and lazy: endless calls of onLazyLoad method even when no scoll event is happening.

@mertsincan mertsincan changed the title Component: VirtualScroller VirtualScroller triggers onLazyLoad event even though there is no scroll event. Nov 7, 2022
@mertsincan
Copy link
Member

For performance, you can use event.forceUpdate(); instead of this.virtualProducts = [...this.virtualProducts];.

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
6 participants