Commit Graph

28 Commits

Author SHA1 Message Date
Roland Geider
2c26c93d68 Merge remote-tracking branch 'origin/master' into fix/build-phase-ui-side-effects 2026-08-21 18:01:56 +02:00
Roland Geider
095323f29b Merge pull request #1327 from wger-project/feature/better-online-gating
Better online gating
2026-08-21 17:48:01 +02:00
Roland Geider
de758b5dfa Final fixes 2026-08-21 17:42:28 +02:00
Roland Geider
a6534dbbd0 Reuse the dialog's local-counter snapshot for the report button 2026-08-21 16:05:02 +02:00
Roland Geider
94d8352c3d Arm the sync watchdog inside connectPowerSync 2026-08-21 15:00:13 +02:00
Roland Geider
2073d462e6 Show a plain outage as disconnected, not as a sync error 2026-08-21 14:46:27 +02:00
Ben Tucker
fe33f693a8 fix(core): make UI side effects and provider reads safe during build
Errors handled while the widget tree is building crashed or wedged the
app in three related ways:

- FlutterError.onError showed dialogs and snackbars synchronously.
  Pushing a route mid-build trips the navigator's !_debugLocked
  assertion, and because the one-dialog guard was set before showDialog
  threw, its release never attached: every later error dialog was then
  silently suppressed while nothing was on screen, leaving a blank,
  unresponsive app until restart. Snackbars crashed outright via the
  messenger's setState.
- The sync status and barcode dialogs did ref.read inside their route
  builders, which run during build. With the provider chain dirty (any
  token refresh dirties wgerBase -> auth), the read flushed it there and
  Riverpod scheduled a scope refresh mid-build. The barcode builder also
  created its search future inline, re-firing the search on every dialog
  rebuild.
- Provider create bodies that widgets watch during build read providers
  synchronously: the dashboard's routine hydration chain crashed on cold
  start right after a token refresh, and TrophyStateNotifier.build()
  has the same shape in the post-login window, where invalidation order
  left networkStatusProvider dirty while its dependents rebuilt.

lib/core/build_safety.dart adds the two idioms as helpers: runAfterFrame
defers UI side effects past the build phase, yieldPastBuild yields
provider create bodies past their synchronous phase (a microtask, not a
timer, since widget tests assert !timersPending at teardown). The error
dialog guard is released when the context is gone or the push fails, the
snackbar helpers re-resolve the messenger inside the callback, the
dialog builders snapshot their providers in the tap handler, and
post-login invalidation runs leaf-first. Regression tests cover each
shape.
2026-08-16 17:29:43 -05:00
Roland Geider
2374e1b0ba Replace flutter_svg_icons with a local SvgIcon widget 2026-08-15 21:52:07 +02:00
Roland Geider
d3749ac37c Report the local sync counters in bug reports 2026-08-15 20:22:19 +02:00
Roland Geider
fb88facda9 Report the local sync counters in bug reports 2026-08-15 20:20:19 +02:00
Roland Geider
fdee8e6935 Tell "connecting" apart from "offline" in the sync icon 2026-08-14 15:47:56 +02:00
Roland Geider
5e332e18aa Connect PowerSync on the adapter state, not on the reachability probe 2026-08-14 14:52:49 +02:00
Roland Geider
aaacb6484c Keep the application logs across a restart 2026-08-09 22:49:04 +02:00
Roland Geider
9fdb13428b Add a filter and copy buttons to the log overview 2026-08-09 22:46:18 +02:00
Sanji78
a9011c54c7 Fix user profile is unavailable with PowerSync 2026-08-09 09:11:13 +02:00
Roland Geider
a1f4844f6c Replace more hard coded colors with theme generated ones 2026-08-04 11:52:29 +02:00
Roland Geider
1af9471ef4 Replace more hard coded colors with theme generated ones 2026-08-04 11:41:17 +02:00
Roland Geider
ec20dd45de Use theme colors instead of fixed ones 2026-08-04 00:01:39 +02:00
Roland Geider
30cc2fc959 Improve logging 2026-07-29 17:42:31 +02:00
Roland Geider
630d4864d8 Cleanup 2026-07-29 17:28:47 +02:00
Roland Geider
9e446e0b94 Allow users to submit issues to github with full stackstrace and sync debug info 2026-07-29 17:23:09 +02:00
Roland Geider
718fa05d1b Add sync diagnostics to the "submit to github" error dialog 2026-07-29 17:06:05 +02:00
Roland Geider
30f44ad471 Show more sync information on the sync status dialog
Also, make it stateful so it shows live data for sync queue size, etc.
2026-07-29 16:50:14 +02:00
Roland Geider
d72a0ccf93 Allow users to force-reconnect to the powersync service 2026-07-29 16:22:30 +02:00
Roland Geider
b277e81088 Detect a sync stream that is blocked on the network path
This might help debugging when an ad-blocker, vpn or similar interferes with
the connections to the sync service

See #1271
2026-07-23 14:56:29 +02:00
Roland Geider
290b991311 Consolidate snackbar calls code into a helper 2026-07-01 22:46:26 +02:00
Roland Geider
0d198745ec Consolidate formatting code into a helper 2026-07-01 22:37:37 +02:00
Roland Geider
60c9f67282 Move shared infra to lib/core/ 2026-07-01 20:28:06 +02:00