Skip to content

fix: fall back to location.origin when VITE_KOMODO_HOST is empty string#1426

Open
ahmd-soliman wants to merge 1 commit into
moghtech:mainfrom
ahmd-soliman:fix/empty-vite-komodo-host
Open

fix: fall back to location.origin when VITE_KOMODO_HOST is empty string#1426
ahmd-soliman wants to merge 1 commit into
moghtech:mainfrom
ahmd-soliman:fix/empty-vite-komodo-host

Conversation

@ahmd-soliman
Copy link
Copy Markdown

Closes #1359.

ui/Dockerfile defaults ARG VITE_KOMODO_HOST="", so any image built without overriding the ARG bakes the empty string into the bundle. ?? only falls back on null/undefined, so KOMODO_BASE_URL ends up as "". That breaks new WebSocket("/ws/update") (absolute URL required) and makes auth/API requests resolve against the page origin instead of the configured backend.

Switching to || covers the empty-string case while preserving the existing behavior for unset and real-URL values.

Reproduced locally with VITE_KOMODO_HOST="" yarn dev:

(await import('/src/main.tsx')).KOMODO_BASE_URL
// Before fix: ""
// After fix:  "http://localhost:5173"

Also verified with the env var unset — output is unchanged either way, so the dev path isn't affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ui] [bug] empty KOMODO_BASE_URL causing error

1 participant