fix: lock lighthouse launch flow to auto sampling (#80)

* fix: lock lighthouse launch flow to auto sampling

* save
This commit is contained in:
Ben Senescu 2026-04-04 18:46:56 -04:00 committed by Ben Senescu
parent f75a1d4156
commit bbed7c760a
3 changed files with 9 additions and 29 deletions

View File

@ -132,9 +132,9 @@ function LighthouseOptions({ launchForm }: Pick<Props, "launchForm">) {
</launchForm.Field>
<span
className="text-sm font-medium text-base-content/80"
title="Run Lighthouse checks through DataForSEO during this audit"
title="Lighthouse measures the performance of your pages and identifies issues."
>
Include Lighthouse checks
Include Lighthouse
</span>
</label>
@ -143,27 +143,11 @@ function LighthouseOptions({ launchForm }: Pick<Props, "launchForm">) {
>
{(runLighthouse) =>
runLighthouse ? (
<div className="flex flex-wrap items-center gap-2">
<span className="text-xs text-base-content/60">Audit scope</span>
<launchForm.Field name="lighthouseMode">
{(field) => (
<select
className="select select-bordered select-xs"
value={field.state.value}
onChange={(event) =>
field.handleChange(
event.target.value === "all" ? "all" : "auto",
)
}
>
<option value="auto">Auto sample (recommended)</option>
<option value="all">All crawled pages</option>
</select>
)}
</launchForm.Field>
<span className="text-xs text-base-content/50">
Powered by DataForSEO Lighthouse
</span>
<div className="space-y-1">
<p className="text-xs text-base-content/60">
We choose a sample of 20 pages to audit, removing pages from
duplicate templates.
</p>
</div>
) : null
}

View File

@ -5,12 +5,10 @@ export type LaunchFormValues = {
url: string;
maxPagesInput: string;
runLighthouse: boolean;
lighthouseMode: "auto" | "all";
};
export const DEFAULT_LAUNCH_FORM_VALUES: LaunchFormValues = {
url: "",
maxPagesInput: "50",
runLighthouse: false,
lighthouseMode: "auto",
};

View File

@ -81,9 +81,7 @@ export function useLaunchController({
projectId,
startUrl: value.url,
maxPages: effectiveMaxPages,
lighthouseStrategy: value.runLighthouse
? value.lighthouseMode
: "none",
lighthouseStrategy: value.runLighthouse ? "auto" : "none",
});
toast.success("Audit started!");
onAuditStarted(result.auditId);
@ -117,7 +115,7 @@ function useLaunchMutations({
projectId: string;
startUrl: string;
maxPages: number;
lighthouseStrategy: "auto" | "all" | "none";
lighthouseStrategy: "auto" | "none";
}) => startAudit({ data }),
});