Skip to content

Commit ee12266

Browse files
committed
fix bug on desktop
1 parent 411cd70 commit ee12266

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/libs/actions/Report.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ import {clearByKey} from './CachedPDFPaths';
197197
import {setDownload} from './Download';
198198
import {close} from './Modal';
199199
import navigateFromNotification from './navigateFromNotification';
200+
import {getAll} from './PersistedRequests';
200201
import {buildAddMembersToWorkspaceOnyxData, buildRoomMembersOnyxData} from './Policy/Member';
201202
import {createPolicyExpenseChats} from './Policy/Policy';
202203
import {
@@ -1108,7 +1109,14 @@ function openReport(
11081109

11091110
// Prepare guided setup data only when nvp_introSelected is set and onboarding is not completed
11101111
// OldDot users will never have nvp_introSelected set, so they will not see guided setup messages
1111-
if (introSelected && !isOnboardingCompleted && !isInviteOnboardingComplete) {
1112+
// Some cases we can have two open report requests with guide setup data because isInviteOnboardingComplete is not updated completely.
1113+
// Then we need to check the list request and prevent the guided setup data from being duplicated.
1114+
const persistedRequests = getAll();
1115+
const hasOpenReportWithGuidedSetupData = persistedRequests.some((request) => request.command === WRITE_COMMANDS.OPEN_REPORT && request.data?.guidedSetupData);
1116+
1117+
// Prepare guided setup data only when nvp_introSelected is set and onboarding is not completed
1118+
// OldDot users will never have nvp_introSelected set, so they will not see guided setup messages
1119+
if (introSelected && !isOnboardingCompleted && !isInviteOnboardingComplete && !hasOpenReportWithGuidedSetupData) {
11121120
const {choice, inviteType} = introSelected;
11131121
const isInviteIOUorInvoice = inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU || inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE;
11141122
const isInviteChoiceCorrect = choice === CONST.ONBOARDING_CHOICES.ADMIN || choice === CONST.ONBOARDING_CHOICES.SUBMIT || choice === CONST.ONBOARDING_CHOICES.CHAT_SPLIT;

0 commit comments

Comments
 (0)