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

Clear out old cached policies #5023

Merged
merged 1 commit into from
Sep 10, 2021
Merged

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Sep 2, 2021

cc @deetergp

Details

I think maybe we did not implement this PR correctly probably because an assumption was made about mergeCollection() that would clear out old cached values. I will have to look into that at some point. But I'm not sure if it works that way.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/174831

Tests / QA Steps

  1. Click the "+" icon and "Create a workspace" when logged into new.expensify.com
  2. Exit the workspace configuration screen by clicking the "x" located top right
  3. Log into expensify.com with the same account and go to Settings > Policies > Group
  4. Delete the Free workspace you created by clicking the settings cog to the right of the workspace name
  5. In new.expensify.com - refresh, click your profile pic, observe the deleted workspaces is not listed in the settings pane (or eventually disappears after API request completes)
  6. Refresh the page with the settings pane open, observe the deleted workspace is not listed

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Note: I am skipping testing on all platforms in the interest of saving time since I can't think of any reason why this code would run differently on native / does not touch UI.

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@marcaaron marcaaron self-assigned this Sep 2, 2021
@marcaaron marcaaron requested a review from a team as a code owner September 2, 2021 18:10
@MelvinBot MelvinBot requested review from joelbettner and removed request for a team September 2, 2021 18:10
if (policyCollection[key]) {
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Is this space necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I just prefer to pad if statements with new lines so things are less visually compressed.

Copy link
Contributor

@deetergp deetergp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had one tiny NAB that you can take or leave, but I am still unclear how this will be updated if someone has deleted one of these policies in OldExpensify. What triggers AuthScreens::componentDidUpdate in this scenario?

@marcaaron
Copy link
Contributor Author

I am still unclear how this will be updated if someone has deleted one of these policies in OldExpensify. What triggers AuthScreens::componentDidUpdate in this scenario?

I believe that a page refresh is the only thing that would update that data (maybe a reconnection - but would have to look). We could create a new issue to see if that's a priority (and sync things up with web sockets, polling, refetch when visiting the settings page or something else), but it feels tangential to the issue reported by @MitchExpensify.

@joelbettner joelbettner merged commit 48ca1b5 into main Sep 10, 2021
@joelbettner joelbettner deleted the marcaaron-fixOldCachedPolicies branch September 10, 2021 18:45
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @joelbettner in version: 1.0.96-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @francoisl in version: 1.0.97-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants