fix(overview): restore lost Dev Previews and Live endpoints lists that were accidentally overwritten during Dashboard migration
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -101,9 +101,12 @@ export async function POST(
|
|||||||
const forceStart =
|
const forceStart =
|
||||||
new URL(request.url).searchParams.get("forceStart") === "true";
|
new URL(request.url).searchParams.get("forceStart") === "true";
|
||||||
|
|
||||||
if (!last && !forceStart) {
|
// If there's no history, we STILL want to auto-start! We just assume it's a standard
|
||||||
return NextResponse.json({ status: "no_history" });
|
// Next.js app on port 3000. Forcing the user to hit "Start Preview" on a new project
|
||||||
}
|
// is unnecessary friction.
|
||||||
|
const commandToRun = last?.command || "npx next dev -H 0.0.0.0 --webpack";
|
||||||
|
const portToRun = last?.port || 3000;
|
||||||
|
const previewUrlToUse = last?.preview_url ?? null;
|
||||||
|
|
||||||
// 3. Load workspace
|
// 3. Load workspace
|
||||||
if (!project.vibn_workspace_id) {
|
if (!project.vibn_workspace_id) {
|
||||||
@@ -116,12 +119,11 @@ export async function POST(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. Fire restart in background — don't block the response.
|
// 4. Fire restart in background — don't block the response.
|
||||||
// If forceStart is true but we have no history, default to Next.js start command.
|
|
||||||
const restartOpts = {
|
const restartOpts = {
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
projectSlug,
|
projectSlug,
|
||||||
command: last?.command || "npx next dev -H 0.0.0.0 --no-turbopack",
|
command: commandToRun,
|
||||||
port: last?.port || 3000,
|
port: portToRun,
|
||||||
workspace,
|
workspace,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,7 +156,7 @@ export async function POST(
|
|||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
status: "starting",
|
status: "starting",
|
||||||
previewUrl: last?.preview_url ?? null,
|
previewUrl: previewUrlToUse,
|
||||||
command: restartOpts.command,
|
command: restartOpts.command,
|
||||||
port: restartOpts.port,
|
port: restartOpts.port,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user