Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,12 @@ const ONYXKEYS = {
/** Indicates whether we should mask fragile user data while exporting onyx state or not */
SHOULD_MASK_ONYX_STATE: 'shouldMaskOnyxState',

/** Indicates whether we should use the staging version of the secure API server */
SHOULD_USE_STAGING_SERVER: 'shouldUseStagingServer',

/** Indicates whether the debug mode is currently enabled */
IS_DEBUG_MODE_ENABLED: 'isDebugModeEnabled',

/** Stores new group chat draft */
NEW_GROUP_CHAT_DRAFT: 'newGroupChatDraft',

Expand Down Expand Up @@ -1203,6 +1209,8 @@ type OnyxValuesMapping = {
[ONYXKEYS.SHOULD_STORE_LOGS]: boolean;
[ONYXKEYS.SHOULD_RECORD_TROUBLESHOOT_DATA]: boolean;
[ONYXKEYS.SHOULD_MASK_ONYX_STATE]: boolean;
[ONYXKEYS.SHOULD_USE_STAGING_SERVER]: boolean;
[ONYXKEYS.IS_DEBUG_MODE_ENABLED]: boolean;
[ONYXKEYS.CACHED_PDF_PATHS]: Record<string, string>;
[ONYXKEYS.POLICY_OWNERSHIP_CHANGE_CHECKS]: Record<string, OnyxTypes.PolicyOwnershipChangeChecks>;
[ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE]: OnyxTypes.QuickAction;
Expand Down
3 changes: 2 additions & 1 deletion src/components/AccountSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
const [accountID] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: (onyxSession) => onyxSession?.accountID});
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const buttonRef = useRef<HTMLDivElement>(null);
const {windowHeight} = useWindowDimensions();

Expand Down Expand Up @@ -224,7 +225,7 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
>
{Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')}
</Text>
{!!account?.isDebugModeEnabled && (
{!!isDebugModeEnabled && (
<Text
style={[styles.textLabelSupporting, styles.mt1, styles.w100]}
numberOfLines={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Account} from '@src/types/onyx';

type ImageRendererWithOnyxProps = {
/** Current user account */
/** Whether we should use the staging version of the secure API server */
// Following line is disabled because the onyx prop is only being used on the memo HOC
// eslint-disable-next-line react/no-unused-prop-types
account: OnyxEntry<Account>;
shouldUseStagingServer: OnyxEntry<boolean>;
};

type ImageRendererProps = ImageRendererWithOnyxProps & CustomRendererProps<TBlock>;
Expand Down Expand Up @@ -150,16 +149,16 @@ ImageRenderer.displayName = 'ImageRenderer';

const ImageRendererMemorize = memo(
ImageRenderer,
(prevProps, nextProps) => prevProps.tnode.attributes === nextProps.tnode.attributes && prevProps.account?.shouldUseStagingServer === nextProps.account?.shouldUseStagingServer,
(prevProps, nextProps) => prevProps.tnode.attributes === nextProps.tnode.attributes && prevProps.shouldUseStagingServer === nextProps.shouldUseStagingServer,
);

function ImageRendererWrapper(props: CustomRendererProps<TBlock>) {
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
const [shouldUseStagingServer] = useOnyx(ONYXKEYS.SHOULD_USE_STAGING_SERVER, {canBeMissing: true});
return (
<ImageRendererMemorize
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
account={account}
shouldUseStagingServer={shouldUseStagingServer}
/>
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navigation/NavigationTabBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function NavigationTabBar({selectedTab, isTooltipAllowed = false, isTopLevelBar
const {translate, preferredLocale} = useLocalize();
const {indicatorColor: workspacesTabIndicatorColor, status: workspacesTabIndicatorStatus} = useWorkspacesTabIndicatorStatus();
const {orderedReportIDs} = useSidebarOrderedReports();
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
const navigationState = useNavigationState(findFocusedRoute);
const initialNavigationRouteState = getWorkspaceNavigationRouteState();
Expand Down Expand Up @@ -102,7 +102,7 @@ function NavigationTabBar({selectedTab, isTooltipAllowed = false, isTopLevelBar
}, [navigationState]);

// On a wide layout DebugTabView should be rendered only within the navigation tab bar displayed directly on screens.
const shouldRenderDebugTabViewOnWideLayout = !!account?.isDebugModeEnabled && !isTopLevelBar;
const shouldRenderDebugTabViewOnWideLayout = !!isDebugModeEnabled && !isTopLevelBar;

useEffect(() => {
setChatTabBrickRoad(getChatTabBrickRoad(orderedReportIDs, reportAttributes));
Expand Down Expand Up @@ -310,7 +310,7 @@ function NavigationTabBar({selectedTab, isTooltipAllowed = false, isTopLevelBar

return (
<>
{!!account?.isDebugModeEnabled && (
{!!isDebugModeEnabled && (
<DebugTabView
selectedTab={selectedTab}
chatTabBrickRoad={chatTabBrickRoad}
Expand Down
6 changes: 2 additions & 4 deletions src/components/TestToolMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ import TestToolRow from './TestToolRow';
import Text from './Text';

const ACCOUNT_DEFAULT: AccountOnyx = {
shouldUseStagingServer: undefined,
isSubscribedToNewsletter: false,
validated: false,
isFromPublicDomain: false,
isUsingExpensifyCard: false,
isDebugModeEnabled: false,
};

function TestToolMenu() {
const {isBetaEnabled} = usePermissions();
const [network] = useOnyx(ONYXKEYS.NETWORK, {canBeMissing: true});
const [account = ACCOUNT_DEFAULT] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
const [isUsingImportedState] = useOnyx(ONYXKEYS.IS_USING_IMPORTED_STATE, {canBeMissing: true});
const shouldUseStagingServer = account?.shouldUseStagingServer ?? isUsingStagingApi();
const isDebugModeEnabled = !!account?.isDebugModeEnabled;
const [shouldUseStagingServer = isUsingStagingApi()] = useOnyx(ONYXKEYS.SHOULD_USE_STAGING_SERVER, {canBeMissing: true});
const [isDebugModeEnabled = false] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const shouldBlockTransactionThreadReportCreation = !!account?.shouldBlockTransactionThreadReportCreation;
const shouldShowTransactionThreadReportToggle = isBetaEnabled(CONST.BETAS.NO_OPTIMISTIC_TRANSACTION_THREADS);
const styles = useThemeStyles();
Expand Down
4 changes: 2 additions & 2 deletions src/libs/ApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ getEnvironment().then((envName) => {
// We only use the value of shouldUseStagingServer to determine which server we should point to.
// Since they aren't connected to a UI anywhere, it's OK to use connectWithoutView()
Onyx.connectWithoutView({
key: ONYXKEYS.ACCOUNT,
key: ONYXKEYS.SHOULD_USE_STAGING_SERVER,
callback: (value) => {
// Toggling between APIs is not allowed on production and internal dev environment
if (ENV_NAME === CONST.ENVIRONMENT.PRODUCTION || CONFIG.IS_USING_LOCAL_WEB) {
Expand All @@ -27,7 +27,7 @@ getEnvironment().then((envName) => {
}

const defaultToggleState = ENV_NAME === CONST.ENVIRONMENT.STAGING || ENV_NAME === CONST.ENVIRONMENT.ADHOC;
shouldUseStagingServer = value?.shouldUseStagingServer ?? defaultToggleState;
shouldUseStagingServer = value ?? defaultToggleState;
},
});
});
Expand Down
15 changes: 2 additions & 13 deletions src/libs/actions/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

let currentUserAccountID: number | undefined;
let currentUserEmail: string;
Onyx.connect({

Check warning on line 38 in src/libs/actions/App.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (val) => {
currentUserAccountID = val?.accountID;
Expand All @@ -62,14 +62,6 @@
},
});

let preservedShouldUseStagingServer: boolean | undefined;
Onyx.connect({
key: ONYXKEYS.ACCOUNT,
callback: (value) => {
preservedShouldUseStagingServer = value?.shouldUseStagingServer;
},
});

// hasLoadedAppPromise is used in the "reconnectApp" function and is not directly associated with the View,
// so retrieving it using Onyx.connectWithoutView is correct.
let resolveHasLoadedAppPromise: () => void;
Expand All @@ -90,7 +82,7 @@
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 85 in src/libs/actions/App.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -123,6 +115,8 @@
ONYXKEYS.CREDENTIALS,
ONYXKEYS.PRESERVED_USER_SESSION,
ONYXKEYS.HYBRID_APP,
ONYXKEYS.SHOULD_USE_STAGING_SERVER,
ONYXKEYS.IS_DEBUG_MODE_ENABLED,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can only include ONYXKEYS.SHOULD_USE_STAGING_SERVER into KEYS_TO_PRESERVE list

ONYXKEYS.IS_DEBUG_MODE_ENABLED seems isn't kept after clear Onyx or signin/signout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just tested, and the debug mode is persisted.

w.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you try to test when turn-on both Debug mode and "Use staging server"?

Screen.Recording.2025-09-04.at.22.28.23.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, that's really weird. Don't you think it's more like a bug, no? Like, why should the debug mode be turned off only if the staging server is on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's because of this

App/src/libs/actions/App.ts

Lines 641 to 643 in 3a05f5b

if (shouldUseStagingServer) {
Onyx.set(ONYXKEYS.ACCOUNT, {shouldUseStagingServer});
}

If the staging server is previously on, after Onyx.clear, we re-set the shouldUseStagingServer using Onyx.set. Not sure why this is needed because we already put ACCOUNT in KEYS_TO_PRESERVE.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Julesssss, what are your thoughts on IS_DEBUG_MODE_ENABLED? It looks like we don't intend to keep this data when switching between OD-ND app, or sign in/out, or resetting Onyx data. Thus, I suggested we can remove it from KEYS_TO_PRESERVE list, but if you think we can leave them as the current implementation of this PR, I'm happy to keep them in the list. It's a troubleshooting config, thus I'm 50:50 on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good spot. So there does seem to be good reason for keeping the staging flag, presumably for testing (original issue).

Not sure why this is needed because we already put ACCOUNT in KEYS_TO_PRESERVE.

So do you think that makes the shouldUseStagingServer condition redundant?

But yeah, similar to the staging env config, I think we should keep IS_DEBUG_MODE_ENABLED to allow us to test/debug flows that include signout.

];

/*
Expand Down Expand Up @@ -218,7 +212,7 @@
function getPolicyParamsForOpenOrReconnect(): Promise<PolicyParamsForOpenOrReconnect> {
return new Promise((resolve) => {
isReadyToOpenApp.then(() => {
const connection = Onyx.connect({

Check warning on line 215 in src/libs/actions/App.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (policies) => {
Expand Down Expand Up @@ -617,7 +611,6 @@
function clearOnyxAndResetApp(shouldNavigateToHomepage?: boolean) {
// The value of isUsingImportedState will be lost once Onyx is cleared, so we need to store it
const isStateImported = isUsingImportedState;
const shouldUseStagingServer = preservedShouldUseStagingServer;
const sequentialQueue = getAll();

rollbackOngoingRequest();
Expand All @@ -637,10 +630,6 @@
Onyx.set(ONYXKEYS.SESSION, preservedUserSession);
Onyx.set(ONYXKEYS.PRESERVED_USER_SESSION, null);
}

if (shouldUseStagingServer) {
Onyx.set(ONYXKEYS.ACCOUNT, {shouldUseStagingServer});
}
})
.then(() => {
// Requests in a sequential queue should be called even if the Onyx state is reset, so we do not lose any pending data.
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/Delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import updateSessionUser from './Session/updateSessionUser';

let delegatedAccess: DelegatedAccess;
Onyx.connect({

Check warning on line 24 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.ACCOUNT,
callback: (val) => {
delegatedAccess = val?.delegatedAccess ?? {};
Expand All @@ -29,31 +29,31 @@
});

let credentials: Credentials = {};
Onyx.connect({

Check warning on line 32 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CREDENTIALS,
callback: (value) => (credentials = value ?? {}),
});

let stashedCredentials: Credentials = {};
Onyx.connect({

Check warning on line 38 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_CREDENTIALS,
callback: (value) => (stashedCredentials = value ?? {}),
});

let session: Session = {};
Onyx.connect({

Check warning on line 44 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => (session = value ?? {}),
});

let stashedSession: Session = {};
Onyx.connect({

Check warning on line 50 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.STASHED_SESSION,
callback: (value) => (stashedSession = value ?? {}),
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 56 in src/libs/actions/Delegate.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (newActivePolicyID) => {
activePolicyID = newActivePolicyID;
Expand All @@ -75,6 +75,8 @@
// This allows the report screen to load correctly when the delegate token expires and the delegate is returned to their original account.
ONYXKEYS.IS_SIDEBAR_LOADED,
ONYXKEYS.NETWORK,
ONYXKEYS.SHOULD_USE_STAGING_SERVER,
ONYXKEYS.IS_DEBUG_MODE_ENABLED,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, we can remove ONYXKEYS.IS_DEBUG_MODE_ENABLED. We can add back when it's nesessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, I think we should preserve this too.

];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/HybridApp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type HybridApp from '@src/types/onyx/HybridApp';
type HybridAppSettings = {
[ONYXKEYS.HYBRID_APP]: HybridApp;
[ONYXKEYS.NVP_TRY_NEW_DOT]?: TryNewDot;
[ONYXKEYS.ACCOUNT]?: {shouldUseStagingServer: boolean};
[ONYXKEYS.SHOULD_USE_STAGING_SERVER]?: boolean;
};

export default HybridAppSettings;
3 changes: 2 additions & 1 deletion src/libs/actions/SignInRedirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

let currentIsOffline: boolean | undefined;
let currentShouldForceOffline: boolean | undefined;
Onyx.connect({

Check warning on line 13 in src/libs/actions/SignInRedirect.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NETWORK,
callback: (network) => {
currentIsOffline = network?.isOffline;
Expand All @@ -28,7 +28,8 @@
keysToPreserve.push(ONYXKEYS.PREFERRED_THEME);
keysToPreserve.push(ONYXKEYS.ACTIVE_CLIENTS);
keysToPreserve.push(ONYXKEYS.DEVICE_ID);
keysToPreserve.push(ONYXKEYS.ACCOUNT);
keysToPreserve.push(ONYXKEYS.SHOULD_USE_STAGING_SERVER);
keysToPreserve.push(ONYXKEYS.IS_DEBUG_MODE_ENABLED);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, we can remove ONYXKEYS.IS_DEBUG_MODE_ENABLED. We can add back when it's nesessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

And here.


// After signing out, set ourselves as offline if we were offline before logging out and we are not forcing it.
// If we are forcing offline, ignore it while signed out, otherwise it would require a refresh because there's no way to toggle the switch to go back online while signed out.
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ function setShouldUseStagingServer(shouldUseStagingServer: boolean) {
if (CONFIG.IS_HYBRID_APP) {
HybridAppModule.shouldUseStaging(shouldUseStagingServer);
}
Onyx.merge(ONYXKEYS.ACCOUNT, {shouldUseStagingServer});
Onyx.set(ONYXKEYS.SHOULD_USE_STAGING_SERVER, shouldUseStagingServer);
}

function togglePlatformMute(platform: Platform, mutedPlatforms: Partial<Record<Platform, true>>) {
Expand Down Expand Up @@ -1405,7 +1405,7 @@ function requestRefund() {
}

function setIsDebugModeEnabled(isDebugModeEnabled: boolean) {
Onyx.merge(ONYXKEYS.ACCOUNT, {isDebugModeEnabled});
Onyx.set(ONYXKEYS.IS_DEBUG_MODE_ENABLED, isDebugModeEnabled);
}

function setShouldBlockTransactionThreadReportCreation(shouldBlockTransactionThreadReportCreation: boolean) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function ProfilePage({route}: ProfilePageProps) {
const [personalDetailsMetadata] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_METADATA, {canBeMissing: true});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
const isDebugModeEnabled = !!account?.isDebugModeEnabled;
const [isDebugModeEnabled = false] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const guideCalendarLink = account?.guideDetails?.calendarLink ?? '';

const accountID = Number(route.params?.accountID ?? CONST.DEFAULT_NUMBER_ID);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail

/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, {canBeMissing: true});
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.isDebugModeEnabled, canBeMissing: false});
const [isDebugModeEnabled = false] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [isLastMemberLeavingGroupModalVisible, setIsLastMemberLeavingGroupModalVisible] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function BaseReportActionContextMenu({
});
const transactionID = getLinkedTransactionID(reportActionID, reportID);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionID)}`, {canBeMissing: true});
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false});
const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true});
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true});
const [originalReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${originalReportID}`, {canBeMissing: true});
const isOriginalReportArchived = useReportIsArchived(originalReportID);
Expand Down Expand Up @@ -232,7 +232,7 @@ function BaseReportActionContextMenu({
isProduction,
moneyRequestAction,
areHoldRequirementsMet,
account,
isDebugModeEnabled,
iouTransaction,
}),
);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ import {
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';
import type {Account, Beta, Card, Download as DownloadOnyx, OnyxInputOrEntry, ReportAction, ReportActionReactions, Report as ReportType, Transaction} from '@src/types/onyx';
import type {Beta, Card, Download as DownloadOnyx, OnyxInputOrEntry, ReportAction, ReportActionReactions, Report as ReportType, Transaction} from '@src/types/onyx';
import type IconAsset from '@src/types/utils/IconAsset';
import KeyboardUtils from '@src/utils/keyboard';
import type {ContextMenuAnchor} from './ReportActionContextMenu';
Expand Down Expand Up @@ -175,7 +175,7 @@ type ShouldShow = (args: {
isProduction: boolean;
moneyRequestAction: ReportAction | undefined;
areHoldRequirementsMet: boolean;
account: OnyxEntry<Account>;
isDebugModeEnabled: OnyxEntry<boolean>;
iouTransaction: OnyxEntry<Transaction>;
}) => boolean;

Expand Down Expand Up @@ -826,7 +826,7 @@ const ContextMenuActions: ContextMenuAction[] = [
isAnonymousAction: true,
textTranslateKey: 'debug.debug',
icon: Expensicons.Bug,
shouldShow: ({type, account}) => [CONST.CONTEXT_MENU_TYPES.REPORT_ACTION, CONST.CONTEXT_MENU_TYPES.REPORT].some((value) => value === type) && !!account?.isDebugModeEnabled,
shouldShow: ({type, isDebugModeEnabled}) => [CONST.CONTEXT_MENU_TYPES.REPORT_ACTION, CONST.CONTEXT_MENU_TYPES.REPORT].some((value) => value === type) && !!isDebugModeEnabled,
onPress: (closePopover, {reportID, reportAction}) => {
if (reportAction) {
Navigation.navigate(ROUTES.DEBUG_REPORT_ACTION.getRoute(reportID, reportAction.reportActionID));
Expand Down
6 changes: 0 additions & 6 deletions src/types/onyx/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,6 @@ type Account = {
/** Whether or not the user is subscribed to news updates */
isSubscribedToNewsletter?: boolean;

/** Whether we should use the staging version of the secure API server */
shouldUseStagingServer?: boolean;

/** Whether we should block the transaction thread report creation */
shouldBlockTransactionThreadReportCreation?: boolean;

Expand All @@ -226,9 +223,6 @@ type Account = {
/** Whether the user is an Expensify Guide */
isGuide?: boolean;

/** Whether the debug mode is currently enabled */
isDebugModeEnabled?: boolean;

/** If user has accessible policies on a private domain */
hasAccessibleDomainPolicies?: boolean;

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/BottomTabBarTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('NavigationTabBar', () => {
describe('Home tab', () => {
describe('Debug mode enabled', () => {
beforeEach(() => {
Onyx.set(ONYXKEYS.ACCOUNT, {isDebugModeEnabled: true});
Onyx.set(ONYXKEYS.IS_DEBUG_MODE_ENABLED, true);
});
describe('Has GBR', () => {
it('renders DebugTabView', async () => {
Expand Down Expand Up @@ -81,7 +81,7 @@ describe('NavigationTabBar', () => {
describe('Settings tab', () => {
describe('Debug mode enabled', () => {
beforeEach(() => {
Onyx.set(ONYXKEYS.ACCOUNT, {isDebugModeEnabled: true});
Onyx.set(ONYXKEYS.IS_DEBUG_MODE_ENABLED, true);
});
describe('Has GBR', () => {
it('renders DebugTabView', async () => {
Expand Down
Loading