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

Infinite scroll keeps recalculating style (in both v1 and v2) #15094

Closed
krispern opened this issue Dec 12, 2022 · 16 comments · Fixed by #15098 or #15226
Closed

Infinite scroll keeps recalculating style (in both v1 and v2) #15094

krispern opened this issue Dec 12, 2022 · 16 comments · Fixed by #15098 or #15226

Comments

@krispern
Copy link

What happened?

Infinite scroll keeps recalculating style, thus keeping the CPU busy (constantly between 6-10%).

The element's stop method stops this from occurring and resume method makes it happen again.

What did you expect to happen?

Once the page is loaded, don't use CPU anymore. There shouldn't really be a need to endlessly do the same operations

Reproduction URL

https://quasar.dev/vue-components/infinite-scroll

How to reproduce?

  1. Go to https://quasar.dev/vue-components/infinite-scroll
  2. Open Task Manager
  3. Note that the Chrome tab for the Infinite Scroll page is constantly using CPU

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar)

Platforms/Browsers

Firefox, Chrome, Other

Quasar info output

No response

Relevant log output

No response

Additional context

I've only tested in Chrome (Version 108.0.5359.98) and Firefox (107.0.1 (64-bit)), there might be other browsers where this is failing.
Using Windows 10 Pro (Version 10.0.19045 Build 19045)

@github-actions
Copy link

Hi @krispern! 👋

It looks like you provided an invalid or unsupported reproduction URL.
Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub.
Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc.
Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

@pdanpdan
Copy link
Collaborator

pdanpdan commented Dec 12, 2022

How did you find it's recalculating styles? And what styles?

@krispern
Copy link
Author

From Chrome Dev Tools' Performance tab. The endlessly repeating part says "Recalculate style" and "Schedule style recalculation"

chrome_2022-12-12_10-24-07

I also think the quasar.dev addresses should be allowed as a reproduction URL because I can't figure out how to get it to work on a Codepen without getting some CSP directive errors in the console, and the issue is also ON the quasar.dev site

@pdanpdan
Copy link
Collaborator

Nice catch :)

Until next release add this to your CSS

.invisible, .invisible *
  visibility: hidden !important
  transition: none !important
  animation: none !important

@krispern
Copy link
Author

@pdanpdan The invisible doesn't seem to be matching anything, thus the change has no effect.

I used it as

<style>
	.invisible,
	.invisible * {
		visibility: hidden !important;
		transition: none !important;
		animation: none !important;
	}
</style>

In the same component where I'm using q-infinite-scroll

@pdanpdan
Copy link
Collaborator

Put it in the global css file - and it matches the loader when it's not active

@krispern
Copy link
Author

krispern commented Dec 12, 2022

I added the css to the global css file now. Looking at the element, it seems the styles are even applied. Unfortunately, that doesn't change anything as the animation/style calculation/CPU use is still continuing.

If there's a fix coming out soon, I can wait for that.

@rstoenescu
Copy link
Member

Fix will be available in Quasar v2.10.3 and v1.22.3

@krispern
Copy link
Author

krispern commented Jan 5, 2023

I've checked the latest v1 and v2 on https://quasar.dev/vue-components/infinite-scroll

Either the fix didn't reach those releases or it's not fixed yet, since the same thing is still happening. Easiest test is to open Chrome Dev Tools -> Performance, then turn the recording on for a second (or longer) and then stop it.

The same style recalculation is constantly happening:
chrome_2023-01-05_11-23-10

pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jan 5, 2023
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jan 5, 2023
@rstoenescu rstoenescu reopened this Jan 6, 2023
rstoenescu pushed a commit that referenced this issue Jan 6, 2023
@rstoenescu
Copy link
Member

Fix will be available in Quasar v2.11.4

@krispern
Copy link
Author

krispern commented Jan 6, 2023

Will the fix also be in v1? We're still using that

@rstoenescu
Copy link
Member

Of course. And I've just released v1.22.4 right now.

Please be aware that we will be extending support for Quasar v1 one more time, for 6 months, but it's final.
Might be a good idea to start upgrading to Quasar v2.

@krispern
Copy link
Author

krispern commented Jan 6, 2023

Thank you for the release and the heads up. We are planning to upgrade to Vue 3, which is the requirement for Quasar v2, but our project is colossal and it's probably not going to happen this year.

@rstoenescu
Copy link
Member

It's not that hard to upgrade to Vue 3, regardless of the project size, trust me. It might seem like a huge deal, but it isn't. You can still use Options API in Vue 3 which will significantly reduce the amount of work and will just leave it down to the small time breaking stuff in Vue 3. And we've kept 99% of the API in sync between Qv1 and Qv2.

@krispern
Copy link
Author

krispern commented Jan 9, 2023

I've checked the new version on your website. The issue is still not fixed in neither v1.22.4 nor v2.11.4. When checking the performance tab in Chrome Dev Tools, it's still showing the same "Schedule Style Recalculation" process. Since it's doing it every 16ms (60fps), could it be that it's trying to animate something? I might be mistaken though as I don't know how the Infinite Scroll works.

@rstoenescu rstoenescu reopened this Jan 9, 2023
@rstoenescu rstoenescu assigned pdanpdan and unassigned pdanpdan Jan 9, 2023
rstoenescu added a commit that referenced this issue Jan 11, 2023
@rstoenescu rstoenescu self-assigned this Jan 11, 2023
rstoenescu added a commit that referenced this issue Jan 11, 2023
rstoenescu added a commit that referenced this issue Jan 11, 2023
…ons in the "loading" slot when slot is not on screen #15094
@rstoenescu
Copy link
Member

Will be available in Quasar v2.11.5 and v1.22.5.

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