Skip to content

CountryField / DfxCountryService robustness follow-ups (post #519) #528

@TaprootFreak

Description

@TaprootFreak

Severity

Medium. Follow-ups left open by #519.

1. Empty filtered list is a silent dead-end

lib/widgets/form/country_field.dart — after filtering by purpose, if the result is empty (where(purpose.allows) yields nothing), the widget renders a DropdownField with items: []. The user sees an empty, un-openable dropdown with no error and no retry; the form stays permanently invalid with no explanation. There is no isEmpty branch analogous to the error branch.

2. Duplicate parallel GET /v1/country

DfxCountryService is registered via registerCachedFactory (lib/setup/di.dart), which is a weak-reference cache, not a true singleton. getAllCountries() checks cachedCountries before its await and sets it only afterwards, with no stored in-flight Future. Two CountryFields mounted in the same frame (the registration step has two) both see an empty cache and fire two parallel GET /v1/country requests. Storing the in-flight future would deduplicate this.

3. Hardcoded, non-localized hintText: 'Schweiz'

country_field.dart passes a hardcoded German hintText: 'Schweiz'. The widget serves four purposes (citizenship + country) and the app is DE/EN localized. The hint is not localized and misleadingly suggests a preselection even though initialValue is null. It should be a localized, neutral hint (or removed).

4. getCountryBySymbol failure crashes the whole settings page

SettingsUserDataCubit (lib/screens/settings_user_data/cubit/settings_user_data_cubit.dart) resolves nationality / addressCountry via getCountryBySymbol. If that throws (e.g. the backend returns a symbol not present in /v1/country), it lands in the generic catch and emits SettingsUserDataFailure — the entire user-data page fails over a single unknown country symbol. Inconsistent with the robust per-field error handling CountryField received in #519.

Context

Found during a deep audit of the KYC country/nationality data path (see #519).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions