flutter: improve address book pull error handling (#14813)

* flutter: improve address book pull error handling

Summary:
  - Show error messages when fetching the address book list fails.
  - After the initial fetch, switching back to the AB tab no longer re-fetches it, even if an error occurred or the error banner was dismissed.

  Tested:
  - Self-hosted server:
    - normal
    - 403 responses
    - legacy address book mode
  - Public server
  - Verified that switching tabs no longer re-fetches AB after the initial fetch, regardless of whether an error occurred or the error banner was cleared.

Signed-off-by: 21pages <sunboeasy@gmail.com>

* use resp.statusCode in address book json decoding

Signed-off-by: 21pages <sunboeasy@gmail.com>

* flutter: clear address book list errors on reset

Signed-off-by: 21pages <sunboeasy@gmail.com>

* flutter: clear address book pull errors consistently

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2026-04-18 11:19:32 +08:00
committed by GitHub
parent 91aff3ffd1
commit ac124c0680
3 changed files with 74 additions and 23 deletions

View File

@@ -54,9 +54,9 @@ class _AddressBookState extends State<AddressBook> {
const LinearProgressIndicator(),
buildErrorBanner(context,
loading: gFFI.abModel.currentAbLoading,
err: gFFI.abModel.currentAbPullError,
err: gFFI.abModel.abPullError,
retry: null,
close: () => gFFI.abModel.currentAbPullError.value = ''),
close: gFFI.abModel.clearPullErrors),
buildErrorBanner(context,
loading: gFFI.abModel.currentAbLoading,
err: gFFI.abModel.currentAbPushError,