Skip to content

Commit e325bcf

Browse files
authored
Merge pull request Expensify#67717 from DylanDylann/remove-connect-method-in-MapboxToken
[No QA]: Refactor src/libs/actions/MapboxToken.ts to remove Onyx.connect() references Expensify#66531
2 parents a7ed0bc + 54612b8 commit e325bcf

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

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=291 --cache --cache-location=node_modules/.cache/eslint",
49+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=288 --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/MapboxToken.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import ONYXKEYS from '@src/ONYXKEYS';
1111
import type {MapboxAccessToken, Network} from '@src/types/onyx';
1212

1313
let authToken: string | undefined;
14-
Onyx.connect({
14+
// Use connectWithoutView since this is only for auth token and don't affect to any UI
15+
Onyx.connectWithoutView({
1516
key: ONYXKEYS.SESSION,
1617
callback: (value) => {
1718
authToken = value?.authToken;
@@ -64,7 +65,8 @@ const init = () => {
6465
}
6566

6667
// When the token changes in Onyx, the expiration needs to be checked so a new token can be retrieved.
67-
tokenConnection = Onyx.connect({
68+
// Use connectWithoutView since this is only for mapbox token and don't affect to any UI
69+
tokenConnection = Onyx.connectWithoutView({
6870
key: ONYXKEYS.MAPBOX_ACCESS_TOKEN,
6971
callback: (token) => {
7072
// Only the leader should be in charge of the mapbox token, or else when you have multiple tabs open, the Onyx connection fires multiple times
@@ -119,7 +121,8 @@ const init = () => {
119121

120122
if (!networkConnection) {
121123
let network: Network | undefined;
122-
networkConnection = Onyx.connect({
124+
// Use connectWithoutView since the network state and don't affect to any UI
125+
networkConnection = Onyx.connectWithoutView({
123126
key: ONYXKEYS.NETWORK,
124127
callback: (value) => {
125128
// When the network reconnects, check if the token has expired. If it has, then clearing the token will

0 commit comments

Comments
 (0)