Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invited members does not reflect in offline mode #22410

Merged
merged 19 commits into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,25 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID,
onyxMethod: Onyx.METHOD.MERGE,
key: membersListKey,

// Convert to object with each key clearing pendingAction. We don’t
// need to remove the members since that will be handled by onClose of OfflineWithFeedback.
value: _.object(accountIDs, Array(accountIDs.length).fill({pendingAction: null, errors: null})),
// Convert to object with each key clearing pendingAction, when it is an existing account.
// Remove the object, when it is a newly created account.
value: _.reduce(
accountIDs,
(accountIDsWithClearedPendingAction, accountID) => {
let value = null;
const accountAlreadyExists = !_.isEmpty(allPersonalDetails[accountID]);

if (accountAlreadyExists) {
value = {pendingAction: null, errors: null};
}

// eslint-disable-next-line no-param-reassign
accountIDsWithClearedPendingAction[accountID] = value;

return accountIDsWithClearedPendingAction;
},
{},
),
},
...newPersonalDetailsOnyxData.successData,
...membersChats.onyxSuccessData,
Expand Down
Loading