Optimize category page size with lazy-hydrate #3327
Labels
5: Complex
feature request
Requests for new features. Please be as specific as possible and provide proposal API if it you can
P4: Nice to have
Priority mark - it's nice to have
Milestone
What is the motivation for adding/enhancing this feature?
Related: #3326
https://github.com/maoberlehner/vue-lazy-hydration
I've used it on the Product page within this branch: https://github.com/DivanteLtd/vue-storefront/tree/feature/3281_state_optimization to avoid attributes being included into INITIAL_STATE (#3281)
If we managed to do the same for
category-next.products
we can save 70% of category page size and decrease the TTI significantly.The challenge
We can hydrate
<product-listing
only after the CSR request for products has been executed (and it's always executed in here)The problem is that
lazy-hydarate
has only the following triggers:ssr-only
,on-interaction
,when-visible
.How to add the hydration only after products have been loaded?
Otherwise, we're getting CSR/SSR mismatch - when the hydration is done before the data is provided.
Idea: maybe the
product-listing
component should take data not from the getter but from kind of Promise (in the end it could be a getter but returning promise; not sure how it will work and if it's even possible?)**How to remove
category-next.products
from INITIAL_STATEIt's very easy. Modify your
default.json
:FROM:
TO:
What are the acceptance criteria
window.__INITIAL_STATE__
doesn't containscategory-next.products
Can you complete this feature request by yourself?
Which Release Cycle state this refers to? Info for developer.
Pick one option.
develop
branch and create Pull Request2. Feature / Improvement
back todevelop
.release
branch and create Pull Request3. Stabilisation fix
back torelease
.hotfix
ormaster
branch and create Pull Request4. Hotfix
back tohotfix
.Additional information
The text was updated successfully, but these errors were encountered: