UI: Set the API client base URL before the first startup request (#72374)
When Airflow is served under a path prefix, the UI sent its first API request to the origin root instead of the prefix. `OpenAPI.BASE` was assigned as a module side effect in `queryClient.ts`, which imports `src/i18n/config`. That module requests the version at module scope to build a translation cache buster, and ES module evaluation runs a dependency to completion before the importing module's body, so the request always went out while `BASE` was still `""`. The generated client builds its URL as `config.BASE + path`, so the request was sent to the origin root. The consequences depend on what else is mounted at `/api/`. In our case the request reaches a different service, which responded with a 401 which the UI reads as an expired session, which redirects to login, which succeeds and reloads, producing an infinite login loop. The request also defeats the feature it exists for: the lookup fails, `resolveI18nVersion` falls back to `Date.now()`, and translations are fetched with a timestamp instead of the version. Move the base href resolution and the client configuration into `src/basePath`, a module with no application dependencies, and have `i18n/config` take its base path from there. The ordering guarantee then comes from a real data dependency rather than from the import graph happening to line up. `utils/links.ts` still reads `<base href>` separately, but it does so at call time rather than module scope, so it is unaffected; consolidating it is left out to keep this change to the bug. Adds a regression test that fails on main with `expected [ '/api/v2/version' ] to deeply equal []`. Closes: #72344
E
Ed Summers committed
1c23f876f235c70ce60e2defc0d644eb65bf299b
Parent: 8cbbf7c
Committed by GitHub <noreply@github.com>
on 9/4/2026, 4:40:08 PM