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

CPU max out when using useInfiniteLoader with totalItems arguement #162

Open
justisom opened this issue Apr 29, 2024 · 1 comment
Open

Comments

@justisom
Copy link

I want to first say thank you for your patience with my many questions over the past few days. I truly appreciate your help and this module has proven to be a one stop shop for a lot of features I wish to implement. THANK YOU!

While trying to implement infinite scrolling I noticed a quirk with totalItems argument in useInfiniteLoader that causes the CPU to spike over 100% when scrolling beyond the item limit.

To Reproduce
I forked the example code and put a print statement in the fakeQuery function. Once I hit the max it starts printing out like crazy and the CPU spikes.

I added totalItems: 100 at line 20 and a print statement at line 129.

Expected behavior
I figured the function call for queries would stop after the limit had been hit.

@jaredLunde
Copy link
Owner

Hmm yeah that does look like there is potentially a bug somewhere in here: https://github.com/jaredLunde/masonic/blob/main/src/use-infinite-loader.ts#L31-L38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants