-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add getPolicyIDFromNavigationState method #38490
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import React, {useEffect} from 'react'; | ||
import {View} from 'react-native'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import useActiveWorkspace from '@hooks/useActiveWorkspace'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Browser from '@libs/Browser'; | ||
import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import Performance from '@libs/Performance'; | ||
import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData'; | ||
import Timing from '@userActions/Timing'; | ||
|
@@ -21,7 +21,7 @@ const startTimer = () => { | |
|
||
function BaseSidebarScreen(props) { | ||
const styles = useThemeStyles(); | ||
const {activeWorkspaceID} = useActiveWorkspace(); | ||
const activeWorkspaceID = Navigation.getPolicyIDFromNavigationState(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need, because getting this value from the context should be faster than invoking this new method, because it has complex logic. In this place in code we need to get this value after update immediately but in other cases context should work fine. cc: @adamgrzybowski There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After some thought, I think we should check the following:
If the answer is no and no then I would consider removing the context. It made sense to have it before ideal-nav-v2. Not sure about the current situation. Keeping only one method to access policyID of the switcher may prevent confusion in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WojtekBoman any update on the comment above? That sounds like a good next step to do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I've checked it in more detail, and the context works faster than this method. Here is necessary because we need to use a new policyID immediately after update, but in other cases it's better to use the context.
This is a method in the |
||
useEffect(() => { | ||
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); | ||
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true); | ||
|
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.
This is not the correct place for this function. This lib should only export helpers for navigation. This is a util function related to 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.
Good point :) I've moved this function to PolicyUtils