Preconnect to checkout origin on cart page#2521
Conversation
🦋 Changeset detectedLatest commit: ca26e6b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
matthewvolk
left a comment
There was a problem hiding this comment.
Nice find! Just one comment to consider. Also might need to run pnpm lint -- --fix
There was a problem hiding this comment.
🍹 Would it be beneficial to use this anywhere else? Wondering if we generalize it CheckoutPreconnect → PreconnectResource and add an optional param for options: PreconnectOptions
There was a problem hiding this comment.
I thought about that, and I don't think so - Next.js already has great defaults for this in the rest of the application, our situation here is special because we are redirecting externally. The other place where this might be useful is in areas where you're likely to proceed directly to checkout, but this is the only place in the Catalyst codebase where this is relevant right now.
2954b1d to
9f6f19b
Compare
9f6f19b to
de1ab08
Compare
de1ab08 to
03ec7e7
Compare
03ec7e7 to
0c60b9d
Compare
0c60b9d to
ca26e6b
Compare
What/Why?
On the cart page, add a preconnect tag for the checkout URL, to make sure DNS and TLS connection is already done by the time the user needs to redirect to checkout, thus improving checkout load performance for the redirected checkout.
https://nextjs.org/docs/app/api-reference/functions/generate-metadata#resource-hints
Testing
Migration