diff --git a/moneymgr_mobile/lib/routes/scan/scan_screen.dart b/moneymgr_mobile/lib/routes/scan/scan_screen.dart index f4d97ed..24eec7e 100644 --- a/moneymgr_mobile/lib/routes/scan/scan_screen.dart +++ b/moneymgr_mobile/lib/routes/scan/scan_screen.dart @@ -36,8 +36,8 @@ class ScanScreen extends HookConsumerWidget { restartScan() async { try { - final val = ref.refresh(_scanDocumentProvider); - Logger.root.info("Load again startup result: $val"); + ref.invalidate(_scanDocumentProvider); + Logger.root.info("Load again startup"); } catch (e, s) { Logger.root.shout("Failed to try again startup loading! $e $s"); } diff --git a/moneymgr_mobile/lib/widgets/expense_editor.dart b/moneymgr_mobile/lib/widgets/expense_editor.dart index 628b0cc..1fec7c8 100644 --- a/moneymgr_mobile/lib/widgets/expense_editor.dart +++ b/moneymgr_mobile/lib/widgets/expense_editor.dart @@ -40,6 +40,15 @@ class ExpenseEditor extends HookConsumerWidget { final (:pending, :snapshot, :hasError) = useAsyncTask(); + // Force refresh of field if required + final previousData = useState(null); + if (initialData != previousData.value) { + previousData.value = initialData; + labelController.text = initialData?.label ?? ""; + costController.text = initialData?.cost.toString() ?? ""; + timeController.value = initialData?.time ?? DateTime.now(); + } + // Clear cost value handleClearCost() { costController.text = "";