You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-09-02] [$250] Copilot - Not here page appears briefly when user switches account on Subscription page #66842
Please re-state the problem that we are trying to solve in this issue.
Copilot - Not here page appears briefly when user switches account on Subscription page
What is the root cause of that problem?
Currently, we don't have a state that reflects Delegate loading, so at one point we have no value for subscriptionPlan and isAppLoading is false, which is why we briefly see the not-found page:
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Remove the loading app key from the preserve key list here. Then this key is always reset when connecting/disconnecting the delegate, and we can capture the correct loading status
When we switch users, the acountID from the session is changed firs,t so we should get the accountID from userMetadata instead to get the correct plan
const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA);
// Filter workspaces in which user is the owner and the type is either corporate (control) or team (collect)
const ownerPolicies = useMemo(() => getOwnedPaidPolicies(policies, userMetadata?.accountID ?? -1), [policies, userMetadata?.accountID]);
or we can define a new field isDelegating in the session data, update this as true in the success data here and reset it after calling OpenApp API here
and then use this data to determine the loading here belongs with isAppLoading
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
But this isn't enough because clearing the onyx happened first before the open app request, so not found will still show briefly.
What changes do you think we should make in order to solve the problem?
We can optimistically set the IS_LOADING_APP when switching the account (connect & disconnect) knowing that we will call open app (set it to false when fails),
changed the title [-]Copilot - Not here page appears briefly when user switches account on Subscription page[/-][+][$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/+]on Jul 23, 2025
changed the title [-][$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/-][+][Due for payment 2025-09-02] [$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/+]on Aug 26, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.98-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@parasharrajat@lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Jul 22, 2025
Triggered auto assignment to @lydiabarclay (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.Eskalifer1 commentedon Jul 22, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copilot - Not here page appears briefly when user switches account on Subscription page
What is the root cause of that problem?
Currently, we don't have a state that reflects Delegate loading, so at one point we have no value for subscriptionPlan and isAppLoading is false, which is why we briefly see the not-found page:
App/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Lines 38 to 43 in 233790a
What changes do you think we should make in order to solve the problem?
We need to add a state that will show the transition between accounts and use it, here are the detailed steps:
App/src/ONYXKEYS.ts
Line 1022 in 233790a
App/src/libs/actions/Delegate.ts
Lines 63 to 78 in 233790a
App/src/libs/actions/Delegate.ts
Lines 189 to 199 in 233790a
App/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Lines 38 to 40 in 233790a
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
nkdengineer commentedon Jul 22, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-08-07 15:36:55 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Not here page appears briefly when switching account on Subscription tab.
What is the root cause of that problem?
When the user switches accounts, the onyx is clear
App/src/libs/actions/Delegate.ts
Line 160 in 233790a
Then
subscriptionPlanbecomesundefined, andisAppLoadingis stillfalse,then the not found page appears briefly beforeOpenAppAPI is calledApp/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Lines 38 to 43 in 233790a
What changes do you think we should make in order to solve the problem?
We should fallback
isAppLoadingastruehere andApp/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Line 36 in 233790a
Remove the loading app key from the preserve key list here. Then this key is always reset when connecting/disconnecting the delegate, and we can capture the correct loading status
When we switch users, the
acountIDfrom the session is changed firs,t so we should get the accountID fromuserMetadatainstead to get the correct planApp/src/hooks/useSubscriptionPlan.ts
Line 10 in 87ec600
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
Before we clear the onyx, set
ONYXKEYS.IS_LOADING_APPtotrue, and we need to do the same fordisconnectfunction.App/src/libs/actions/Delegate.ts
Line 160 in 233790a
or we can define a new field
isDelegatingin the session data, update this astruein the success data here and reset it after callingOpenAppAPI hereand then use this data to determine the loading here belongs with
isAppLoadingApp/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Lines 38 to 43 in 233790a
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
bernhardoj commentedon Jul 22, 2025
My proposal is basically the same concept as @Eskalifer1, but I had posted this before in #48246, so I'm not sure if my proposal can be considered.
(In #48246, the C+ implemented only part of my proposal, so I updated the proposal a bit to remove the one that is already implemented.)
Proposal
Please re-state the problem that we are trying to solve in this issue.
Subscription page shows not found when switching account.
What is the root cause of that problem?
When we switch account, we clear the onyx and calls open app.
App/src/libs/actions/Delegate.ts
Lines 160 to 167 in 233790a
Because the data is cleared, the subscription data is gone. We already have a code to show the loader.
App/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx
Lines 36 to 43 in 233790a
But this isn't enough because clearing the onyx happened first before the open app request, so not found will still show briefly.
What changes do you think we should make in order to solve the problem?
We can optimistically set the IS_LOADING_APP when switching the account (connect & disconnect) knowing that we will call open app (set it to false when fails),
App/src/libs/actions/Delegate.ts
Lines 94 to 108 in 233790a
Or, we can introduce a new onyx key called IS_SWITCHING_ACCOUNT.
Or, we can just add it as a new property to ACCOUNT
and also we need to preserve the key so it won't be cleared.
App/src/libs/actions/Delegate.ts
Lines 63 to 78 in 233790a
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
[-]Copilot - Not here page appears briefly when user switches account on Subscription page[/-][+][$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/+]melvin-bot commentedon Jul 23, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021948164743590231456
melvin-bot commentedon Jul 23, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)parasharrajat commentedon Jul 29, 2025
Reviewing it today.
41 remaining items
[-][$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/-][+][Due for payment 2025-09-02] [$250] Copilot - Not here page appears briefly when user switches account on Subscription page[/+]melvin-bot commentedon Aug 26, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Aug 26, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.98-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-09-02. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Aug 26, 2025
@parasharrajat @lydiabarclay The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
parasharrajat commentedon Aug 26, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Fix copilot bugs #48517 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/543207
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
lydiabarclay commentedon Sep 3, 2025
Payment Summary
Contributor: @nkdengineer paid $250 via Upwork
Contributor+: @parasharrajat due $250 via NewDot
✅ Regression test filed
parasharrajat commentedon Sep 3, 2025
Payment requested as per #66842 (comment)
quinthar commentedon Sep 15, 2025
Approve $250 for @parasharrajat