Skip to content

Commit 94098b2

Browse files
committed
fix(ui): expose isStaticSpa toggle for nixpacks + publish directory
The backend already honors isStaticSpa for the Nixpacks builder when a publishDirectory is set (getStaticCommand generates an SPA-aware nginx config with try_files fallback to index.html), but the build type form only wired the field for the Static builder. As a result the toggle never rendered for Nixpacks and any save in that mode silently cleared the flag via the discriminated union schema and resetData mapping. Add isStaticSpa to the nixpacks schema variant and resetData case, render the same SPA checkbox once a publish directory is set, and include the field in the save mutation payload for nixpacks. Fixes Dokploy#4993
1 parent 53feb9d commit 94098b2

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

  • apps/dokploy/components/dashboard/application/build

‎apps/dokploy/components/dashboard/application/build/show.tsx‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const mySchema = z.discriminatedUnion("buildType", [
8888
z.object({
8989
buildType: z.literal(BuildType.nixpacks),
9090
publishDirectory: z.string().optional(),
91+
isStaticSpa: z.boolean().default(false),
9192
}),
9293
z.object({
9394
buildType: z.literal(BuildType.railpack),
@@ -138,6 +139,7 @@ const resetData = (data: ApplicationData): AddTemplate => {
138139
return {
139140
buildType: BuildType.nixpacks,
140141
publishDirectory: data.publishDirectory || undefined,
142+
isStaticSpa: data.isStaticSpa ?? false,
141143
};
142144
case BuildType.paketo_buildpacks:
143145
return {
@@ -179,6 +181,7 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
179181

180182
const buildType = form.watch("buildType");
181183
const railpackVersion = form.watch("railpackVersion");
184+
const publishDirectory = form.watch("publishDirectory");
182185
const [isManualRailpackVersion, setIsManualRailpackVersion] = useState(false);
183186

184187
useEffect(() => {
@@ -224,7 +227,10 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
224227
? data.herokuVersion
225228
: null,
226229
isStaticSpa:
227-
data.buildType === BuildType.static ? data.isStaticSpa : null,
230+
data.buildType === BuildType.static ||
231+
data.buildType === BuildType.nixpacks
232+
? data.isStaticSpa
233+
: null,
228234
railpackVersion:
229235
data.buildType === BuildType.railpack
230236
? data.railpackVersion || "0.15.4"
@@ -419,6 +425,30 @@ export const ShowBuildChooseForm = ({ applicationId }: Props) => {
419425
)}
420426
/>
421427
)}
428+
{buildType === BuildType.nixpacks && publishDirectory && (
429+
<FormField
430+
control={form.control}
431+
name="isStaticSpa"
432+
render={({ field }) => (
433+
<FormItem>
434+
<FormControl>
435+
<div className="flex items-center gap-x-2 p-2">
436+
<Checkbox
437+
id="checkboxIsStaticSpaNixpacks"
438+
value={String(field.value)}
439+
checked={field.value}
440+
onCheckedChange={field.onChange}
441+
/>
442+
<FormLabel htmlFor="checkboxIsStaticSpaNixpacks">
443+
Single Page Application (SPA)
444+
</FormLabel>
445+
</div>
446+
</FormControl>
447+
<FormMessage />
448+
</FormItem>
449+
)}
450+
/>
451+
)}
422452
{buildType === BuildType.static && (
423453
<FormField
424454
control={form.control}

0 commit comments

Comments
 (0)