Force refresh of expenses editor
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -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");
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,15 @@ class ExpenseEditor extends HookConsumerWidget {
 | 
			
		||||
 | 
			
		||||
    final (:pending, :snapshot, :hasError) = useAsyncTask();
 | 
			
		||||
 | 
			
		||||
    // Force refresh of field if required
 | 
			
		||||
    final previousData = useState<BaseExpenseInfo?>(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 = "";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user