Skip to content

Commit 0258912

Browse files
committed
fix eslint comments
1 parent cf9774d commit 0258912

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/pages/iou/request/step/IOURequestStepDistance/hooks/useDistanceTransactionBackup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function useDistanceTransactionBackup({transaction, isCreatingNewRequest, isEdit
4343
return () => {
4444
// If the user cancels out of the modal without saving changes, then the original transaction
4545
// needs to be restored from the backup so that all changes are removed.
46-
// eslint-disable-next-line react-hooks/exhaustive-deps
46+
// eslint-disable-next-line react-hooks/exhaustive-deps -- ref reads are stable; we intentionally read the latest `.current` at unmount
4747
if (transactionWasSavedRef.current) {
4848
removeBackupTransaction(transaction?.transactionID);
4949
return;
@@ -56,7 +56,7 @@ function useDistanceTransactionBackup({transaction, isCreatingNewRequest, isEdit
5656
}
5757
openReport({reportID: transaction?.reportID, introSelected, betas});
5858
};
59-
// eslint-disable-next-line react-hooks/exhaustive-deps
59+
// eslint-disable-next-line react-hooks/exhaustive-deps -- mount/unmount-only effect: backup on mount, restore-or-drop on unmount, never re-runs
6060
}, []);
6161
}
6262

src/pages/iou/request/step/IOURequestStepDistance/hooks/useOdometerReadingsState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function useOdometerReadingsState({currentTransaction, isEditing, selectedTab, i
153153
const endValue = currentEnd !== null && currentEnd !== undefined ? currentEnd.toString() : '';
154154

155155
if (startValue || endValue) {
156-
// eslint-disable-next-line react-hooks/set-state-in-effect
156+
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: syncing local form state from the Onyx transaction (an external source) when the user navigates back to the page
157157
setStartReading(startValue);
158158
setEndReading(endValue);
159159
startReadingRef.current = startValue;

src/pages/iou/request/step/IOURequestStepDistance/hooks/useOdometerTransactionBackup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ function useOdometerTransactionBackup({
3838
createBackupTransaction(transaction, isTransactionDraft, true);
3939

4040
return () => {
41-
// eslint-disable-next-line react-hooks/exhaustive-deps
41+
// eslint-disable-next-line react-hooks/exhaustive-deps -- ref reads are stable; we intentionally read the latest `.current` at unmount to decide between bypass / drop / restore
4242
if (backupHandledManuallyRef.current) {
4343
return;
4444
}
45-
// eslint-disable-next-line react-hooks/exhaustive-deps
45+
// eslint-disable-next-line react-hooks/exhaustive-deps -- ref reads are stable; we intentionally read the latest `.current` at unmount
4646
if (didSaveEditingConfirmationRef.current) {
4747
removeBackupTransactionWithImageCleanup(transactionID, isTransactionDraft);
4848
return;
4949
}
5050
restoreOriginalTransactionFromBackupWithImageCleanup(transactionID, isTransactionDraft);
5151
};
5252
// We only want to create the backup once on mount and restore/remove it on unmount
53-
// eslint-disable-next-line react-hooks/exhaustive-deps
53+
// eslint-disable-next-line react-hooks/exhaustive-deps -- mount/unmount-only effect, never re-runs
5454
}, []);
5555
}
5656

0 commit comments

Comments
 (0)