From 9255b3b7c2542076058a1884bce5509f080f73a9 Mon Sep 17 00:00:00 2001 From: alberto Date: Wed, 6 May 2026 11:46:48 +0200 Subject: [PATCH 1/2] properly clean Onyx when deleting CSV feeds --- src/libs/actions/CompanyCards.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index d43870b31d39..0a75138be095 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -316,7 +316,6 @@ function deleteWorkspaceCompanyCardFeed( const optimisticFeedUpdates = {[bankName]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}; const failureFeedUpdates = {[bankName]: {pendingAction: null, errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage')}}; const optimisticCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}])); - const successCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, null])); const failureCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, {pendingAction: null}])); const optimisticData: Array< @@ -349,11 +348,14 @@ function deleteWorkspaceCompanyCardFeed( ]; // Card collections only: API onyxData provides SHARED_NVP on success (avoid merge-after-set on that key). + // Use SET null to fully clear the feed's card data, including cardList (unassigned cards) which + // MERGE with individual card IDs would leave behind. + const successCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, null])); const successData: Array> = [ { - onyxMethod: Onyx.METHOD.MERGE, + onyxMethod: Onyx.METHOD.SET, key: `${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${domainOrWorkspaceAccountID}_${bankName}`, - value: successCardUpdates, + value: null, }, { onyxMethod: Onyx.METHOD.MERGE, From d64de2a82578e006bbb9ea5d817af3413ade2e2f Mon Sep 17 00:00:00 2001 From: alberto Date: Wed, 6 May 2026 11:59:39 +0200 Subject: [PATCH 2/2] uneeded comment --- src/libs/actions/CompanyCards.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 0a75138be095..8d55d77397ca 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -348,8 +348,6 @@ function deleteWorkspaceCompanyCardFeed( ]; // Card collections only: API onyxData provides SHARED_NVP on success (avoid merge-after-set on that key). - // Use SET null to fully clear the feed's card data, including cardList (unassigned cards) which - // MERGE with individual card IDs would leave behind. const successCardUpdates = Object.fromEntries(cardIDs.map((cardID) => [cardID, null])); const successData: Array> = [ {