Open Codebreaker101 opened 2 years ago
+1 I use Quasar with Vite, I also have pages with a lot of inputs and it makes my app ridiculously slow. Would love some performance tips.
I have used both Vite and Webpack build modes for my project, which renders a lot of q-table/q-btn,... components on one page, and my app loads very slowly. Hopefully, there will be a solution to improve performance.
same here! any solution? i'm using quasar with vite
Ugh, the only solution I know (and use) is to create a progressiveLoading
ref which is just a counter.
Then you do:
function bumpProgressiveLoading() {
progressiveLoading.value += 1;
const maxLength = myArrayWithElements.length;
if (progressiveLoading.value < maxLength - 1) {
nextTick(() => {
setTimeout(bumpProgressiveLoading, 1);
});
}
}
onMounted(bumpProgressiveLoading);
Then, in your template, add a v-if/v-else based on the index. Render a q-skeleton
if the index didn't reach the element's index. q-skeletons
are very fast to render compared to q-inputs
.
This means that as the user navigates to your page, they will just see a list of skeletons first, and that list will progressively turn into something useful. Pay attention to rerenders and ensure that your q-inputs don't get rerendered every time (you will probably need to create components for each item in the array even if you don't want to).
Basically, it's manual time slicing.
Actually, this makes me think that Vue should provide a helper for time-slicing… This way, you could batch many updates into a single render cycle while maintaining responsiveness.
That being said, still, why the hell are q-inputs so slow to render?
What happened?
When having a lot of q-input components on a page it takes a while to render, especially if you have label and hint enabled.
Here are some screenshots from vue dev tools:
Is this how it is supposed to be? If yes, what can one do to improve performance while rendering lots of inputs?
What did you expect to happen?
I expected for it not to be that slow.
Reproduction URL
https://codesandbox.io/s/musing-glade-nlkdp?file=/src/pages/Index.vue
How to reproduce?
Flavour
Quasar CLI (@quasar/cli | @quasar/app)
Areas
Components (quasar)
Platforms/Browsers
Firefox, Chrome
Quasar info output
Relevant log output
No response
Additional context
No response