Skip to content

Commit

Permalink
Drop usage of withOnyx on modified pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Kicu committed Sep 19, 2024
1 parent 584ac31 commit bbc400e
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/pages/settings/Troubleshoot/TroubleshootPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useCallback, useMemo, useState} from 'react';
import {View} from 'react-native';
import Onyx, {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import Onyx, {useOnyx} from 'react-native-onyx';
import type {SvgProps} from 'react-native-svg';
import ClientSideLoggingToolMenu from '@components/ClientSideLoggingToolMenu';
import ConfirmModal from '@components/ConfirmModal';
Expand Down Expand Up @@ -39,14 +38,7 @@ type BaseMenuItem = {
action: () => void | Promise<void>;
};

type TroubleshootPageOnyxProps = {
shouldStoreLogs: OnyxEntry<boolean>;
shouldMaskOnyxState: boolean;
};

type TroubleshootPageProps = TroubleshootPageOnyxProps;

function TroubleshootPage({shouldStoreLogs, shouldMaskOnyxState}: TroubleshootPageProps) {
function TroubleshootPage() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isProduction} = useEnvironment();
Expand All @@ -55,6 +47,9 @@ function TroubleshootPage({shouldStoreLogs, shouldMaskOnyxState}: TroubleshootPa
const {shouldUseNarrowLayout} = useResponsiveLayout();
const illustrationStyle = getLightbulbIllustrationStyle();

const [shouldStoreLogs] = useOnyx(ONYXKEYS.SHOULD_STORE_LOGS);
const [shouldMaskOnyxState = true] = useOnyx(ONYXKEYS.SHOULD_MASK_ONYX_STATE);

const exportOnyxState = useCallback(() => {
ExportOnyxState.readFromOnyxDatabase().then((value: Record<string, unknown>) => {
const dataToShare = ExportOnyxState.maskOnyxState(value, shouldMaskOnyxState);
Expand Down Expand Up @@ -177,12 +172,4 @@ function TroubleshootPage({shouldStoreLogs, shouldMaskOnyxState}: TroubleshootPa

TroubleshootPage.displayName = 'TroubleshootPage';

export default withOnyx<TroubleshootPageProps, TroubleshootPageOnyxProps>({
shouldStoreLogs: {
key: ONYXKEYS.SHOULD_STORE_LOGS,
},
shouldMaskOnyxState: {
key: ONYXKEYS.SHOULD_MASK_ONYX_STATE,
selector: (shouldMaskOnyxState) => shouldMaskOnyxState ?? true,
},
})(TroubleshootPage);
export default TroubleshootPage;

0 comments on commit bbc400e

Please sign in to comment.