Notechondria

Version: 0.1.44 Build Date: 2026-04-19T15:00

What's Changed

Fix: login prompt showed stale/default backend URL, not the configured one

The login dialog, the learner header, the front-page URL badge, and a handful of other UI surfaces were reading _httpClient?.baseUrl to decide which backend URL to display. That reads from the HTTP client's in-memory _baseUrl field, which diverges from the user's saved setting in two scenarios:

  1. Boot race. HttpNotechondriaClient() is constructed in MyApp.build() without initialBaseUrl, so it starts life pointing at _defaultApiBaseUrl() (http://localhost:9080/api/v1 on native, /api/v1 on web). _loadLocalState() later calls _httpClient.updateBaseUrl(_localSettings['api_base_url']), but any UI drawn before that async load settles reads the default.
  2. Post-save rebuild gap. ApiClient.updateBaseUrl mutates _baseUrl in place without notifying listeners, and _applyLocalAppSettings doesn't setState. If the next frame doesn't rebuild the header/dialog, it keeps showing the pre-save baseUrl.

Fix: switch the eight apiBaseUrl: _httpClient?.baseUrl call sites to _localSettings['api_base_url']?.toString() ?? _httpClient?.baseUrl. _localSettings is the source of truth — it's loaded synchronously into state during _loadLocalState before the first paint it influences, and _applyLocalAppSettings rewrites it before the updateBaseUrl call, so it's never less fresh than the HTTP client's view. The _httpClient?.baseUrl fallback preserves behaviour during the brief window before _loadLocalState completes.

The save pipeline itself (via _LocalAppStore.saveSettings to the notechondria.local_settings shared_preferences key) was always correct — this is purely a display bug on the read side.

Files Changed

New

  • docs/versions/0.1.44.md (this file).

Modified

Verification

  • editor_app / planner_app / portal_app: flutter analyze issue counts unchanged vs 0.1.43 (54 / 70 / 68); no errors. flutter test test/smoke_test.dart passes on all three.

Notes / follow-ups

  • A deeper fix would make ApiClient extend ChangeNotifier (or expose a ValueListenable<String> for baseUrl) so updateBaseUrl notifies subscribers automatically. That would also let us remove the manual _localSettings-vs-baseUrl priority and let the HTTP client be the single source of truth. Deferred to avoid a wider API-client refactor for a one-line display bug.
  • The normalization asymmetry (user types http://host:8000, client stores http://host:8000/api/v1) is still present but is now hidden from the user: _apiHostSubtitle in notechondria_shared/lib/src/components/auth_dialogs.dart parses out just the authority for display, so the trailing /api/v1 is never shown. No change needed there this round.