From 1288a6d48c04a06e5dee29c8197a51431a47a468 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Sat, 2 Aug 2025 18:02:16 +0700 Subject: [PATCH] remove onyx connect --- package.json | 2 +- src/libs/Network/SequentialQueue.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c2618e1f7d4d..abedf6ce38c8 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=327 --cache --cache-location=node_modules/.cache/eslint", + "lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=324 --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/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index ad8c1ff4aea6..34c217b19d4f 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -21,7 +21,8 @@ import type {ConflictData} from '@src/types/onyx/Request'; import {isOffline, onReconnection} from './NetworkStore'; let shouldFailAllRequests: boolean; -Onyx.connect({ +// Use connectWithoutView since this is for network data and don't affect to any UI +Onyx.connectWithoutView({ key: ONYXKEYS.NETWORK, callback: (network) => { if (!network) { @@ -78,7 +79,8 @@ function flushOnyxUpdatesQueue() { let queueFlushedDataToStore: OnyxUpdate[] = []; -Onyx.connect({ +// Use connectWithoutView since this is for network queue and don't affect to any UI +Onyx.connectWithoutView({ key: ONYXKEYS.QUEUE_FLUSHED_DATA, callback: (val) => { if (!val) { @@ -227,7 +229,8 @@ function flush(shouldResetPromise = true) { } // Ensure persistedRequests are read from storage before proceeding with the queue - const connection = Onyx.connect({ + // Use connectWithoutView since this is for network queue and don't affect to any UI + const connection = Onyx.connectWithoutView({ key: ONYXKEYS.PERSISTED_REQUESTS, // We exceptionally opt out of reusing the connection here to avoid extra callback calls due to // an existing connection already made in PersistedRequests.ts.