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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=332 --cache --cache-location=node_modules/.cache/eslint",
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=331 --cache --cache-location=node_modules/.cache/eslint",
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
"lint-watch": "npx eslint-watch --watch --changed",
"shellcheck": "./scripts/shellCheck.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function BaseRecordTroubleshootDataToolMenu({
} else {
Performance.disableMonitoring();
}
toggleProfileTool();
toggleProfileTool(isProfilingInProgress);
return () => {
Performance.disableMonitoring();
};
Expand Down
10 changes: 2 additions & 8 deletions src/libs/actions/ProfilingTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ import Onyx from 'react-native-onyx';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

let isProfilingInProgress = false;
Onyx.connect({
key: ONYXKEYS.APP_PROFILING_IN_PROGRESS,
callback: (val) => (isProfilingInProgress = val ?? false),
});

/**
* Toggle the test tools modal open or closed.
* Throttle the toggle to make the modal stay open if you accidentally tap an extra time, which is easy to do.
*/
function toggleProfileTool() {
const toggle = () => Onyx.set(ONYXKEYS.APP_PROFILING_IN_PROGRESS, !isProfilingInProgress);
function toggleProfileTool(isProfilingInProgress = false) {
const toggle = () => Onyx.set(ONYXKEYS.APP_PROFILING_IN_PROGRESS, isProfilingInProgress);
const throttledToggle = throttle(toggle, CONST.TIMING.TEST_TOOLS_MODAL_THROTTLE_TIME);
throttledToggle();
}
Expand Down
Loading