Skip to content

fix(ui): expose isStaticSpa toggle for nixpacks + publish directory - #4994

Merged
Siumauricio merged 1 commit into
Dokploy:canaryfrom
elisiumm:fix/nixpacks-static-spa-toggle
Aug 6, 2026
Merged

fix(ui): expose isStaticSpa toggle for nixpacks + publish directory#4994
Siumauricio merged 1 commit into
Dokploy:canaryfrom
elisiumm:fix/nixpacks-static-spa-toggle

Conversation

@elisiumm

@elisiumm elisiumm commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

Exposes the Is Static SPA toggle in the Build Type form for Nixpacks + Publish Directory, and stops the flag from being dropped on save in that mode.

Fixes #4993

Why

The backend already supports isStaticSpa for Nixpacks builds: when a publishDirectory is set, nixpacks.ts calls getStaticCommand(application), which reads isStaticSpa and, when true, generates the nginx config with the SPA fallback try_files $uri $uri/ /index.html.

However, the UI form in apps/dokploy/components/dashboard/application/build/show.tsx only wired isStaticSpa into the static variant of the z.discriminatedUnion. As a result, for buildType: nixpacks:

  • the toggle was never rendered, so there was no way to enable the SPA fallback from the UI;
  • the field was omitted from the submit payload, so any Build config save in Nixpacks mode reset the value to null.

Net user-facing effect: a deep-link hard-refresh / cold-start on a client-side route (/planning, /users/:id, …) returned a 404 from nginx because try_files was absent — the SPA never loaded on first hit. This is a very common setup for monorepos where the Static build type can't run the build step.

The Dosu triage on #4993 confirmed the gap and traced it to an integration oversight between #297 (Nixpacks publishDirectory support) and #1931 (which added the isStaticSpa toggle only for static). Railpack does not call getStaticCommand, so it is intentionally left untouched.

Changes

Single file, UI-only, no backend change:

  • Add isStaticSpa: z.boolean().default(false) to the nixpacks discriminated-union variant.
  • Mirror it in resetData's nixpacks case.
  • Include isStaticSpa in the submit payload for static or nixpacks (else null).
  • Render the existing SPA checkbox when buildType === nixpacks && publishDirectory is set — reusing the exact pattern of the static block, with a distinct DOM id (checkboxIsStaticSpaNixpacks) to avoid a duplicate id.

Testing

  • pnpm --filter=dokploy run typecheck (tsc --noEmit): clean, no diagnostics. The discriminated union now types isStaticSpa: boolean for nixpacks, and resetData stays exhaustive/symmetric with static.
  • pnpm exec biome check on the touched file: clean, no fixes applied.

Honest disclosure per CONTRIBUTING: I verified the change by typecheck + Biome + code review of the schema/reset/render paths, but I did not run the full local stack (Docker + Postgres + server:3000) for an interactive browser round-trip. The backend path this restores (getStaticCommand → nginx SPA fallback) is already proven working on a real running instance — with isStaticSpa forced directly in the DB, the generated nginx serves index.html with HTTP 200 on client routes; this PR only reconnects the UI plumbing to that already-working backend path. Happy to add a screencast or a scoped test on show.tsx if maintainers prefer.

Greptile Summary

This PR exposes the existing SPA setting for Nixpacks applications that specify a publish directory and preserves that setting through build-configuration saves.

  • Adds isStaticSpa to the Nixpacks form schema and reset data.
  • Includes the Nixpacks SPA value in the submitted build configuration.
  • Conditionally renders the SPA checkbox when Nixpacks static publishing is active.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The added field is consistently represented in validation, reset state, submission, and rendering, while the checkbox visibility matches the Nixpacks builder condition that activates static publishing.

Reviews (1): Last reviewed commit: "fix(ui): expose isStaticSpa toggle for n..." | Re-trigger Greptile

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
@elisiumm
elisiumm requested a review from Siumauricio as a code owner August 6, 2026 12:27
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 6, 2026
@Siumauricio Siumauricio added the hotfix Cherry-pick this fix to main for next patch release label Aug 6, 2026
@Siumauricio
Siumauricio merged commit dd04312 into Dokploy:canary Aug 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotfix Cherry-pick this fix to main for next patch release size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] isStaticSpa (SPA fallback) is applied by the Nixpacks builder but not exposed nor preserved in the UI for buildType: nixpacks

2 participants