Skip to content

Commit c6a970a

Browse files
authored
Merge pull request #54581 from bernhardoj/fix/54509-ws-switcher-resets-to-all-when-send-invoice
Fix LHN filter resets to all when sending invoice for the first time
2 parents 58539c5 + d715ed8 commit c6a970a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,29 @@ import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData';
1515
import Timing from '@userActions/Timing';
1616
import CONST from '@src/CONST';
1717
import ONYXKEYS from '@src/ONYXKEYS';
18+
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
1819

1920
function BaseSidebarScreen() {
2021
const styles = useThemeStyles();
2122
const activeWorkspaceID = useActiveWorkspaceFromNavigationState();
2223
const {translate} = useLocalize();
2324
const {shouldUseNarrowLayout} = useResponsiveLayout();
24-
const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? CONST.DEFAULT_NUMBER_ID}`);
25+
const [activeWorkspace, activeWorkspaceResult] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? CONST.DEFAULT_NUMBER_ID}`);
26+
const isLoading = isLoadingOnyxValue(activeWorkspaceResult);
2527

2628
useEffect(() => {
2729
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED);
2830
Timing.start(CONST.TIMING.SIDEBAR_LOADED);
2931
}, []);
3032

3133
useEffect(() => {
32-
if (!!activeWorkspace || activeWorkspaceID === undefined) {
34+
if (!!activeWorkspace || activeWorkspaceID === undefined || isLoading) {
3335
return;
3436
}
3537

3638
Navigation.navigateWithSwitchPolicyID({policyID: undefined});
3739
updateLastAccessedWorkspace(undefined);
38-
}, [activeWorkspace, activeWorkspaceID]);
40+
}, [activeWorkspace, activeWorkspaceID, isLoading]);
3941

4042
const shouldDisplaySearch = shouldUseNarrowLayout;
4143

0 commit comments

Comments
 (0)