From ffda81624caef6987a960c645cabf880ae45cbea Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Wed, 6 Aug 2025 18:12:19 +0200 Subject: [PATCH 1/4] Replace connect with connectWithoutView --- src/libs/addEncryptedAuthTokenToURL.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/addEncryptedAuthTokenToURL.ts b/src/libs/addEncryptedAuthTokenToURL.ts index 49c0afe5fe99..9b9c562fc5c0 100644 --- a/src/libs/addEncryptedAuthTokenToURL.ts +++ b/src/libs/addEncryptedAuthTokenToURL.ts @@ -2,7 +2,7 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; let encryptedAuthToken = ''; -Onyx.connect({ +Onyx.connectWithoutView({ key: ONYXKEYS.SESSION, callback: (session) => (encryptedAuthToken = session?.encryptedAuthToken ?? ''), }); From b248d4fb7ce6be50026df91b6f5ca8eb63733228 Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Wed, 6 Aug 2025 18:13:05 +0200 Subject: [PATCH 2/4] update --max-warnings --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 740a5b541049..732ef0b90227 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand", "perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure", "typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc", - "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=311 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=310 --cache --cache-location=node_modules/.cache/eslint", "lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh", "lint-watch": "npx eslint-watch --watch --changed", "shellcheck": "./scripts/shellCheck.sh", From ef448739a852c089737e3c728cb28e419a56a83c Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Thu, 7 Aug 2025 15:34:15 +0200 Subject: [PATCH 3/4] Enhance addEncryptedAuthTokenToURL.ts with comments explaining the use of connectWithoutView for module-level variable updates --- src/libs/addEncryptedAuthTokenToURL.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/addEncryptedAuthTokenToURL.ts b/src/libs/addEncryptedAuthTokenToURL.ts index 9b9c562fc5c0..83c9239eff67 100644 --- a/src/libs/addEncryptedAuthTokenToURL.ts +++ b/src/libs/addEncryptedAuthTokenToURL.ts @@ -2,6 +2,9 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; let encryptedAuthToken = ''; +// We use `connectWithoutView` here since this connection only updates a module-level variable +// and doesn't need to trigger component re-renders. UI components get the current token +// value when they call the exported function. Onyx.connectWithoutView({ key: ONYXKEYS.SESSION, callback: (session) => (encryptedAuthToken = session?.encryptedAuthToken ?? ''), From 66471b1bc7ec126578ed4d82bb183808e19a093b Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Thu, 7 Aug 2025 15:34:55 +0200 Subject: [PATCH 4/4] Update ESLint max warnings limit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 434a49a67ccb..c1c5374338f5 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand", "perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure", "typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc", - "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=302 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=301 --cache --cache-location=node_modules/.cache/eslint", "lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh", "lint-watch": "npx eslint-watch --watch --changed", "shellcheck": "./scripts/shellCheck.sh",