Skip to content

Commit

Permalink
Merge pull request #54581 from bernhardoj/fix/54509-ws-switcher-reset…
Browse files Browse the repository at this point in the history
…s-to-all-when-send-invoice

Fix LHN filter resets to all when sending invoice for the first time
  • Loading branch information
nkuoch authored Dec 26, 2024
2 parents 58539c5 + d715ed8 commit c6a970a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData';
import Timing from '@userActions/Timing';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

function BaseSidebarScreen() {
const styles = useThemeStyles();
const activeWorkspaceID = useActiveWorkspaceFromNavigationState();
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? CONST.DEFAULT_NUMBER_ID}`);
const [activeWorkspace, activeWorkspaceResult] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? CONST.DEFAULT_NUMBER_ID}`);
const isLoading = isLoadingOnyxValue(activeWorkspaceResult);

useEffect(() => {
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED);
Timing.start(CONST.TIMING.SIDEBAR_LOADED);
}, []);

useEffect(() => {
if (!!activeWorkspace || activeWorkspaceID === undefined) {
if (!!activeWorkspace || activeWorkspaceID === undefined || isLoading) {
return;
}

Navigation.navigateWithSwitchPolicyID({policyID: undefined});
updateLastAccessedWorkspace(undefined);
}, [activeWorkspace, activeWorkspaceID]);
}, [activeWorkspace, activeWorkspaceID, isLoading]);

const shouldDisplaySearch = shouldUseNarrowLayout;

Expand Down

0 comments on commit c6a970a

Please sign in to comment.