diff --git a/package.json b/package.json index 07c461375047..7f4f7c1a06ed 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=283 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=282 --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", diff --git a/src/libs/addEncryptedAuthTokenToURL.ts b/src/libs/addEncryptedAuthTokenToURL.ts index 49c0afe5fe99..83c9239eff67 100644 --- a/src/libs/addEncryptedAuthTokenToURL.ts +++ b/src/libs/addEncryptedAuthTokenToURL.ts @@ -2,7 +2,10 @@ import Onyx from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; let encryptedAuthToken = ''; -Onyx.connect({ +// 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 ?? ''), });