condition
on fields within a complex collections cause major UI lag
#1381
Replies: 3 comments 2 replies
-
Hey @klapec — I see what you're going after here. Yes, our current implementation of We do use conditions quite frequently in large projects and have not seen this level of UI lag, so I'm thinking there may be some more optimizations you could do to the way that you're using them. Could you utilize a
Could you, instead of having template overrides exist on the top-level Pages collection, maybe have the overrides themselves exist in a different collection? There may be some performance optimizations to make with the frequency that What are your thoughts? I'd like to suggest that this is moved to a Discussion for now, because at some point having too many top-level conditions will inevitably create performance issues. I'm not sure off the top of my head how we can rectify this 100%. However, if you can hook me up with a reproducible repo, and some seeded data maybe, I think that would be great. Maybe we could batch together the Let me know! |
Beta Was this translation helpful? Give feedback.
-
Vue builds an internal dependency graph for computed properties. It only observes dependencies that are actually accessed. For this usecase, where most state changes do not affect most conditions, it could save many calculations. I could not find an off-the-shelf library to handle this. Payload is in control of the arguments that are passed to conditions, so it seems pretty doable to build such a system. |
Beta Was this translation helpful? Give feedback.
-
I want to revisit this old topic. We've encountered a performance issue with ~400 elements and ~10 nested fields. First off, what do you think about this hack in
The two main optimizations are:
Thoughts, @jmikrut? More importantly, I can't find this block in the beta branch. |
Beta Was this translation helpful? Give feedback.
-
Bug Report
I'm building a new CMS for my client and I've noticed that once I put
condition
on some of the fields (mainlyarray
-s androw
-s) within a complex collection (~16KB of response when querying a single document with the REST api, over 3k lines of prettified json) the UI initially becomes laggy. Looking at the chrome devtools' performance tab I noticed that the browser spends most of the time on the'MODIFY_CONDITION'
case within the field reducer.Here's the saved performance profiles
The difference is staggering - browser spends approximately 5 seconds before the
relationship
field is filled with the correct value and during that time the UI is completely unresponsive. And that's on my mbpro m1, this would've been even worse on my client's old pc laptops.I'll share more data (like the collection file or a sample document) privately if needed.
About the use case - I've got
Pages
andTemplates
collections. The "raw" template data is contained withinTemplates
documents (slots, components info, meta tags etc.) and a Page has ahasMany: false
relation to Templates. So, for example, there could be a couple of "search results"-type pages, each having a different URL value but they all point to the same Template. This is done to reduce the data footprint on the mongodb weight - we've got lots of pages (it's an ecommerce site).But here's the twist though - each "section" of a template (there are three:
searchState
,slots
,metaProperties
) can be overrode within a page, so that for example many pages can point to the same template BUT each of them can override particular meta properties.And so we've thought that we'd slap a
override
checkbox field within each section in the Pages collection and once user clicks it the section expands - and we've done it with thecondition
option.We've got beforeRead hooks that deal with responding with the correct data and that works beautifully.
The only thing that's left is UI responsiveness.
Beta Was this translation helpful? Give feedback.
All reactions