From 2204996f78ec499f0af56781699c1626dad9abe2 Mon Sep 17 00:00:00 2001 From: thelullabyy Date: Mon, 26 May 2025 16:57:07 +0700 Subject: [PATCH 1/2] fix: copilot open not here page when switching account --- src/libs/API/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/API/index.ts b/src/libs/API/index.ts index 0ba6391d21bc4..bfad20d9dc012 100644 --- a/src/libs/API/index.ts +++ b/src/libs/API/index.ts @@ -3,6 +3,7 @@ import Onyx from 'react-native-onyx'; import type {SetRequired} from 'type-fest'; import Log from '@libs/Log'; import {handleDeletedAccount, HandleUnusedOptimisticID, Logging, Pagination, Reauthentication, RecheckConnection, SaveResponseInOnyx} from '@libs/Middleware'; +import {saveWorkspacesTabPathToSessionStorage} from '@libs/Navigation/helpers/lastVisitedTabPathUtils'; import {isOffline} from '@libs/Network/NetworkStore'; import {push as pushToSequentialQueue, waitForIdle as waitForSequentialQueueIdle} from '@libs/Network/SequentialQueue'; import Pusher from '@libs/Pusher'; @@ -13,7 +14,7 @@ import type OnyxRequest from '@src/types/onyx/Request'; import type {PaginatedRequest, PaginationConfig, RequestConflictResolver} from '@src/types/onyx/Request'; import type Response from '@src/types/onyx/Response'; import type {ApiCommand, ApiRequestCommandParameters, ApiRequestType, CommandOfType, ReadCommand, SideEffectRequestCommand, WriteCommand} from './types'; -import {READ_COMMANDS} from './types'; +import {READ_COMMANDS, SIDE_EFFECT_REQUEST_COMMANDS} from './types'; // Setup API middlewares. Each request made will pass through a series of middleware functions that will get called in sequence (each one passing the result of the previous to the next). // Note: The ordering here is intentional as we want to Log, Recheck Connection, Reauthenticate, and Save the Response in Onyx. Errors thrown in one middleware will bubble to the next. @@ -175,6 +176,9 @@ function makeRequestWithSideEffects( onyxData: OnyxData = {}, ): Promise { Log.info('[API] Called API makeRequestWithSideEffects', false, {command, ...apiCommandParameters}); + if (command == SIDE_EFFECT_REQUEST_COMMANDS.DISCONNECT_AS_DELEGATE || command == SIDE_EFFECT_REQUEST_COMMANDS.CONNECT_AS_DELEGATE) { + saveWorkspacesTabPathToSessionStorage('/settings/workspaces'); + } const request = prepareRequest(command, CONST.API_REQUEST_TYPE.MAKE_REQUEST_WITH_SIDE_EFFECTS, apiCommandParameters, onyxData); // Return a promise containing the response from HTTPS From 639e62e180539cd512ea4bdd0c526248efd8f960 Mon Sep 17 00:00:00 2001 From: thelullabyy Date: Mon, 26 May 2025 17:08:54 +0700 Subject: [PATCH 2/2] fix ESlint --- src/libs/API/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/API/index.ts b/src/libs/API/index.ts index bfad20d9dc012..58b73def9fc35 100644 --- a/src/libs/API/index.ts +++ b/src/libs/API/index.ts @@ -176,7 +176,7 @@ function makeRequestWithSideEffects( onyxData: OnyxData = {}, ): Promise { Log.info('[API] Called API makeRequestWithSideEffects', false, {command, ...apiCommandParameters}); - if (command == SIDE_EFFECT_REQUEST_COMMANDS.DISCONNECT_AS_DELEGATE || command == SIDE_EFFECT_REQUEST_COMMANDS.CONNECT_AS_DELEGATE) { + if (command === SIDE_EFFECT_REQUEST_COMMANDS.DISCONNECT_AS_DELEGATE || command === SIDE_EFFECT_REQUEST_COMMANDS.CONNECT_AS_DELEGATE) { saveWorkspacesTabPathToSessionStorage('/settings/workspaces'); } const request = prepareRequest(command, CONST.API_REQUEST_TYPE.MAKE_REQUEST_WITH_SIDE_EFFECTS, apiCommandParameters, onyxData);