Unverified 提交 dc33f678 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Fix Vercel Live URL not updating after new deployments (#2283)

## Summary - Updates the Vercel deployment URL when refreshing deployments to show the most recent READY production deployment - Previously, the Live URL was only set once during project creation or connection and never updated - Now when users click "Refresh Deployments", the Live URL will update to reflect the latest production deployment Fixes #2208 ## Test plan - [ ] Connect an app to a Vercel project - [ ] Verify the Live URL is shown correctly - [ ] Push a new deployment to Vercel - [ ] Click "Refresh Deployments" in Dyad - [ ] Verify the Live URL updates to reflect the new deployment 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Ensures the app’s Vercel Live URL stays current after refreshing deployments. > > - In `vercel_handlers.ts`, when fetching deployments, finds the most recent `READY` production deployment and updates `apps.vercelDeploymentUrl` if it changed (with logging) > - In `VercelConnector.tsx`, after `getDeployments()` completes, calls `refreshApp()` so the updated Live URL is shown in the UI > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2f2cccc87b91a3653b70d008b7f208a9aebd7af6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Ensures the Vercel Live URL updates to the latest READY production deployment when users refresh deployments, fixing the stale URL issue. Fixes #2208. - **Bug Fixes** - Call refreshApp() after getDeployments in VercelConnector to refresh the Live URL. - In IPC handler, detect the most recent READY production deployment and update vercelDeploymentUrl in the DB only when it changes. <sup>Written for commit 2f2cccc87b91a3653b70d008b7f208a9aebd7af6. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
上级 a34709c3
......@@ -63,6 +63,8 @@ function ConnectedVercelConnector({
try {
const minLoadingTime = new Promise((resolve) => setTimeout(resolve, 750));
await Promise.all([getDeployments(), minLoadingTime]);
// Refresh app data to get the updated deployment URL
refreshApp();
} finally {
setIsRefreshing(false);
}
......
......@@ -464,13 +464,32 @@ async function handleGetVercelDeployments(
// Get deployments for the project
const deploymentsResponse = await vercel.deployments.getDeployments({
projectId: app.vercelProjectId,
limit: 3, // Get last 3 deployments
limit: 5, // Get last 5 deployments
});
if (!deploymentsResponse.deployments) {
throw new Error("Failed to retrieve deployments from Vercel.");
}
// Find the most recent READY production deployment and update the stored URL
const readyProductionDeployment = deploymentsResponse.deployments.find(
(d) => d.readyState === "READY" && d.target === "production",
);
if (readyProductionDeployment?.url) {
const newDeploymentUrl = `https://${readyProductionDeployment.url}`;
// Only update if the URL has changed
if (newDeploymentUrl !== app.vercelDeploymentUrl) {
logger.info(
`Updating deployment URL for app ${appId}: ${app.vercelDeploymentUrl} -> ${newDeploymentUrl}`,
);
await db
.update(apps)
.set({ vercelDeploymentUrl: newDeploymentUrl })
.where(eq(apps.id, appId));
}
}
// Map deployments to our interface format
return deploymentsResponse.deployments.map((deployment) => ({
uid: deployment.uid,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论