Skip to content

Commit 89718f1

Browse files
authored
Merge pull request Expensify#71670 from parasharrajat/onyx/69030-3
[No QA] [Part 2] Refactor Onyx.connect() for the key: ONYXKEYS.COLLECTION.TRANSACTION_BACKUP in src/libs/actions/TransactionEdit.ts
2 parents 9c57425 + fd83e74 commit 89718f1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4747
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4848
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
49-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=179 --cache --cache-location=node_modules/.cache/eslint",
49+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=178 --cache --cache-location=node_modules/.cache/eslint",
5050
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
5151
"lint-watch": "npx eslint-watch --watch --changed",
5252
"shellcheck": "./scripts/shellCheck.sh",

src/libs/actions/TransactionEdit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function restoreOriginalTransactionFromBackup(transactionID: string | undefined,
5757
return;
5858
}
5959

60-
connection = Onyx.connect({
60+
// We need to use connectWithoutView as this action is called during unmount, and we need to read the latest value from Onyx before we can restore it. As it is called during unmount, it does not impact UI rendering.
61+
connection = Onyx.connectWithoutView({
6162
key: `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`,
6263
callback: (backupTransaction) => {
6364
Onyx.disconnect(connection);

0 commit comments

Comments
 (0)