@@ -43,19 +43,21 @@ function ReportFieldsInitialValuePage({
43
43
const hasAccountingConnections = PolicyUtils . hasAccountingConnections ( policy ) ;
44
44
const reportField = policy ?. fieldList ?. [ ReportUtils . getReportFieldKey ( reportFieldID ) ] ?? null ;
45
45
const availableListValuesLength = ( reportField ?. disabledOptions ?? [ ] ) . filter ( ( disabledListValue ) => ! disabledListValue ) . length ;
46
-
47
- const [ initialValue , setInitialValue ] = useState ( WorkspaceReportFieldUtils . getReportFieldInitialValue ( reportField ) ) ;
46
+ const currentInitialValue = WorkspaceReportFieldUtils . getReportFieldInitialValue ( reportField ) ;
47
+ const [ initialValue , setInitialValue ] = useState ( currentInitialValue ) ;
48
48
49
49
const submitForm = useCallback (
50
50
( values : FormOnyxValues < typeof ONYXKEYS . FORMS . WORKSPACE_REPORT_FIELDS_FORM > ) => {
51
- ReportField . updateReportFieldInitialValue ( policyID , reportFieldID , initialValue === values . initialValue ? '' : values . initialValue ) ;
51
+ if ( currentInitialValue !== values . initialValue ) {
52
+ ReportField . updateReportFieldInitialValue ( policyID , reportFieldID , values . initialValue ) ;
53
+ }
52
54
Navigation . goBack ( ) ;
53
55
} ,
54
- [ policyID , reportFieldID , initialValue ] ,
56
+ [ policyID , reportFieldID , currentInitialValue ] ,
55
57
) ;
56
58
57
59
const submitListValueUpdate = ( value : string ) => {
58
- ReportField . updateReportFieldInitialValue ( policyID , reportFieldID , initialValue === value ? '' : value ) ;
60
+ ReportField . updateReportFieldInitialValue ( policyID , reportFieldID , currentInitialValue === value ? '' : value ) ;
59
61
Navigation . goBack ( ) ;
60
62
} ;
61
63
0 commit comments