-
Notifications
You must be signed in to change notification settings - Fork 404
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
Prefetch apis for SPAs #130
Comments
Hi Robin, thanks for submitting this feedback. I think that data-attribute usage might help but it would also increase the DOM size if you have lots of PLP elements. Another approach would be to possibly specify in QuickLink a Custom Handler to define the URL to be added into the Link=Prefetch tags, the callback would be responsible to either select the HREF attribute from the A as default or construct the API URL that in your case it would be the same as Prefetching the PDP itself from the Network point of view. |
Thanks Alexandre, @thearegee please check this pull request if it would satisfy your needs: #123 |
@gilbertococchi this would be perfect for us, any progress on getting this merged? |
We used this PR: #123 To run some experiments to see if this was worth it, on this page: We added When the customer clicked the product, the API would already be cached: This effective saved the user 250ms of waiting. However we decided vs the bandwidth cost: And the fact that without naked eye we couldn't see the difference. It was not worth it. If interested this is our quick hack for how we referenced the API: In this instance we will probably not follow this up. |
It looks like ona Fast 3G Connection it would save approx 600-800ms TTFB time by downloading a 6-8KB JSON content. |
This is a good point, I think it could be done with both. A prefetch on intersected elements and then cached with SW. At the moment our API is just too large for all the prefetching. So I need to do some work to slim this down. I still think this is a great addition to the library though but we can't experiment further without: #123 |
Hi @thearegee, this is an old issue, but #123 has finally landed into the library around October 2020. From your previous comment it seems like this was everything you needed to make this work. Perhaps others can find your tests useful for similar needs as well. Closing this one. Please, feel free to reopen if you need anything else. |
Hey guys,
First of all thanks for the module, it looks great and something we are really interested in using it.
However we have a slightly different request, because our website is an SPA. I'm interested in using it here:
https://www.mrporter.com/en-us/mens/clothing
This could be used for either linking to Product details, or using filters. Ignoring how we detect intention, I'm interested in prefetching data from the relevant api.
This can be interpreted from the products part number or the filters path.
I've not had a huge think about how this could be implemented yet, but if for example we might want to be able to have different api prefetches based on an element type:
GET /my-filters-endpoint/${filter-id}
GET /my-product-endpoint/${product-id}
You would need the ability to prefetch based on the element "type", maybe this could be done with data attributes or configure different
quicklink
instances based onThe DOM element to observe for in-viewport links to prefetch.
I just wanted to start the conversation, would people be interested in this?
The text was updated successfully, but these errors were encountered: