-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: WS switcher and LHN are not reset to Expensify after leaving #45285
Conversation
@@ -20,6 +26,19 @@ const screenOptions: StackNavigationOptions = { | |||
|
|||
function BottomTabNavigator() { | |||
const activeRoute = useNavigationState<RootStackParamList, NavigationPartialRoute<CentralPaneName> | undefined>(getTopmostCentralPaneRoute); | |||
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subscribe only to the active workspace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this changed supposed to be on the SidebarScreen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the SidebarScreen is always mounted again once we leave the workspace then return to LHN. Because it is mounted again, so the logic:
!selectedPolicy && !prevSelectedPolicy
that used in my solution is always false
because both of them are undefined
when we leave the workspace then return to LHN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the logic back to the Sidebar and in the useEffect only check for the current selected policy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s77rt As I said above, we cannot move the logic to Sidebar. Can you help check again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why we can't go with the suggested solution above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I explained above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both of them are
undefined
You should check only the current selected policy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you mean we should !selectedPolicy
instead of !selectedPolicy && !prevSelectedPolicy
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the logic back to the Sidebar and in the useEffect only check for the current selected policy
Working on it now |
@s77rt I updated PR |
|
||
useEffect(() => { | ||
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); | ||
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true); | ||
}, []); | ||
|
||
const [selectedPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [selectedPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`); | |
const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`); |
NAB. Naming consistency
I updated PR |
@truph01 In testing step 7 can you please add "Verify" before the sentence for clarity |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemweb-chrome.moviOS: Nativeios.moviOS: mWeb Safarimweb-safari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
@s77rt I addressed all your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.0.15-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.15-9 🚀
|
Details
Fixed Issues
$ #43981
PROPOSAL: #43981 (comment)
Tests
Precondition:
User is invited to a workspace.
LHN will show all the chats because Expensify is selected.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-07-11.at.22.52.34.mov
Android: mWeb Chrome
Screen.Recording.2024-07-11.at.23.11.28.mov
iOS: Native
Screen.Recording.2024-07-11.at.23.03.51.mov
iOS: mWeb Safari
Screen.Recording.2024-07-11.at.22.56.08.mov
MacOS: Chrome / Safari
Screen.Recording.2024-07-11.at.22.39.18.mov
MacOS: Desktop
Screen.Recording.2024-07-11.at.22.41.42.mov