From 0e804cb2313665118f4a58bbd9397e47eeb89cf5 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Sun, 3 Aug 2025 10:36:58 +0700 Subject: [PATCH 1/2] remove connect method --- package.json | 2 +- src/libs/actions/Link.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 04d22167ebab..d9123613678b 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=320 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=318 --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/actions/Link.ts b/src/libs/actions/Link.ts index eb3bb9a8a01a..bee8035393bf 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -15,14 +15,16 @@ import ROUTES from '@src/ROUTES'; import {canAnonymousUserAccessRoute, isAnonymousUser, signOutAndRedirectToSignIn} from './Session'; let isNetworkOffline = false; -Onyx.connect({ +// Use connectWithoutView since this is to open an external link and doesn't affect any UI +Onyx.connectWithoutView({ key: ONYXKEYS.NETWORK, callback: (value) => (isNetworkOffline = value?.isOffline ?? false), }); let currentUserEmail = ''; let currentUserAccountID: number = CONST.DEFAULT_NUMBER_ID; -Onyx.connect({ +// Use connectWithoutView since this is to open an external link and doesn't affect any UI +Onyx.connectWithoutView({ key: ONYXKEYS.SESSION, callback: (value) => { currentUserEmail = value?.email ?? ''; @@ -238,7 +240,6 @@ function getTravelDotLink(policyID: OnyxEntry) { } export { - buildOldDotURL, openOldDotLink, openExternalLink, openLink, From 22adccee1e5ee6983c81444e416e260ca3df60c1 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Sun, 3 Aug 2025 10:45:30 +0700 Subject: [PATCH 2/2] prettier --- src/libs/actions/Link.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index bee8035393bf..3929b288f7d7 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -239,14 +239,4 @@ function getTravelDotLink(policyID: OnyxEntry) { }); } -export { - openOldDotLink, - openExternalLink, - openLink, - getInternalNewExpensifyPath, - getInternalExpensifyPath, - openTravelDotLink, - buildTravelDotURL, - openExternalLinkWithToken, - getTravelDotLink, -}; +export {openOldDotLink, openExternalLink, openLink, getInternalNewExpensifyPath, getInternalExpensifyPath, openTravelDotLink, buildTravelDotURL, openExternalLinkWithToken, getTravelDotLink};