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 =
|
||||
new URL(request.url).searchParams.get("forceStart") === "true";
|
||||
|
||||
if (!last && !forceStart) {
|
||||
return NextResponse.json({ status: "no_history" });
|
||||
}
|
||||
// If there's no history, we STILL want to auto-start! We just assume it's a standard
|
||||
// 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
|
||||
if (!project.vibn_workspace_id) {
|
||||
@@ -116,12 +119,11 @@ export async function POST(
|
||||
}
|
||||
|
||||
// 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 = {
|
||||
projectId: project.id,
|
||||
projectSlug,
|
||||
command: last?.command || "npx next dev -H 0.0.0.0 --no-turbopack",
|
||||
port: last?.port || 3000,
|
||||
command: commandToRun,
|
||||
port: portToRun,
|
||||
workspace,
|
||||
};
|
||||
|
||||
@@ -154,7 +156,7 @@ export async function POST(
|
||||
|
||||
return NextResponse.json({
|
||||
status: "starting",
|
||||
previewUrl: last?.preview_url ?? null,
|
||||
previewUrl: previewUrlToUse,
|
||||
command: restartOpts.command,
|
||||
port: restartOpts.port,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user