Conversation
|
@tblivet I’d be interested in your thoughts on this approach, especially since you had some concerns about the previous hook-based solution in #988. This PR moves to semantic Do you think this direction addresses the concerns you raised on #988? Any feedback or suggestions would be very welcome. |
9b98037 to
110977d
Compare
|
@tblivet, a quick follow-up on this PR. On the LiteSpeed side I’ve now simplified the implementation quite a bit by reusing the native At this point, the main thing I’d like to confirm is whether adding these The intent is for them to act only as semantic markers identifying dynamic blocks such as Do you see any issue with having these attributes in the theme markup, or would this approach be acceptable for Hummingbird? Thanks 🙏 |
110977d to
b6dd298
Compare
|
Hi @Codencode 👋 I much prefer this approach over the dedicated hooks from #988. |
|
Thanks @tblivet, I understand the concern. From my point of view, having a semantic marker like data-ps-fragment directly in the theme could add value beyond LiteSpeed itself, because it would make PrestaShop themes easier to integrate with external caching or rendering systems without relying on theme-specific classes or IDs. Of course, this does not mean every cache system would automatically become fully compatible, but I’m working in that direction and I think cache integration is an important topic for a CMS like PrestaShop. That said, I understand the hesitation about introducing markup mainly driven by a third-party integration, so I’m happy to wait for @kpodemski and @jolelievre’s feedback before pushing this further. |
data-ps-fragmentmarkers fornotifications,product-add-to-cart, andproduct-additional-info, allowing integrations to identify dynamic blocks from the final HTML without adding dedicated before/after hooks or cache-specific logic to the theme.The markers are applied directly to the existing block containers. The
notificationscontainer is always present, even when empty, so the fragment can be identified when the page is initially generated and handled dynamically on subsequent cached requests.product-additional-infois also marked because it is already returned by the native product AJAX refresh flow and contains thedisplayProductAdditionalInfohook. This allows integrations to regenerate the whole block through the standardProductControllerflow instead of rebuilding hook parameters manually.The
data-ps-fragmentattribute is also documented inCONTEXT.mdas part of Hummingbird's semanticdata-ps-*attributes.The related LiteSpeed Cache implementation is available in litespeedtech/lscache_prestashop#107 and depends on these markers to isolate the dynamic blocks from the full-page cache and regenerate them through ESI.
This approach replaces the dedicated theme hooks previously proposed in #988. If this PR and the related LiteSpeed Cache PR are merged, #988 can be closed.
2. Open a product page and verify that the
product-add-to-cartcontainer containsdata-ps-fragment="product-add-to-cart".3. Verify that the
product-additional-infocontainer containsdata-ps-fragment="product-additional-info".4. Verify that the notifications area is wrapped with
data-ps-fragment="notifications"even when there are no notifications.5. Check that the page renders normally and that the Add to cart block, additional product information, and notifications keep their existing behavior.