feat: add warm-up script function to fetch resources before injection#99
feat: add warm-up script function to fetch resources before injection#99TheodoreRed wants to merge 1 commit intovercel:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@TheodoreRed is attempting to deploy a commit to the Analytics Test Projects Team on Vercel. A member of the Team first needs to authorize it. |
🤖 AI Preview TestHey! We noticed you're doing amazing open source work. We built an AI model that's really good at testing web applications, so we ran it on your preview deployment to help catch any issues. Preview URL: https://speed-insights-astro-git-fork-theodorered-main-vercel-analytics.vercel.app What We Found✅ Preview deployment detected and queued for testing. Want unlimited free access? We'd love to support your project with free AI-powered testing! If you'd rather we not comment on your PRs, just 👎 this message and we'll remove you from our list. Automated by Morph • Learn more |
📓 What's in there?
This PR improves the script injection process for Vercel Speed Insights by adding a warm-up function. Before injecting the main script, the code performs a fetch to the script URL to "warm up" the endpoint (even if the first response might be HTML). This change is intended to reduce errors related to cold starts, ensuring that when the actual script is loaded, the endpoint is ready to serve valid JavaScript.
Issue #98
🧪 How to test?
Open a page that uses Speed Insights injection.
Verify that the script tag is appended to the document head after the warm-up call.
❗ Notes to reviewers
This change is purely additive and does not affect the core functionality of Speed Insights.
Please verify that this approach reduces errors associated with cold starts without introducing side effects in both development and production environments.