Skip to content

Commit 219512e

Browse files
committed
feat: introduce useReactScan hook for React Scan integration
- Added a new useReactScan hook to manage React Scan initialization and settings dynamically based on development settings. - Removed the previous implementation of useReactScan from the provider hooks to streamline the code structure. - Updated Bootstrap to utilize the new useReactScan hook, enhancing separation of concerns and maintainability.
1 parent 783d7b8 commit 219512e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/kit/src/provider/hooks/useReactScan.ts renamed to packages/kit/src/hooks/useReactScan.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ export const useReactScan =
3030
await scanAsync({
3131
enabled: true,
3232
showToolbar: devSettings.settings.reactScanShowToolbar ?? true,
33-
animationSpeed: (animationSpeed === 'fast' ||
34-
animationSpeed === 'slow' ||
35-
animationSpeed === 'off'
36-
? animationSpeed
37-
: 'fast') as 'fast' | 'slow' | 'off',
33+
animationSpeed:
34+
animationSpeed === 'fast' ||
35+
animationSpeed === 'slow' ||
36+
animationSpeed === 'off'
37+
? animationSpeed
38+
: 'fast',
3839
trackUnnecessaryRenders:
3940
devSettings.settings.reactScanTrackUnnecessaryRenders ?? true,
4041
});

packages/kit/src/provider/Bootstrap.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import backgroundApiProxy from '../background/instance/backgroundApiProxy';
4646
import { useAppUpdateInfo } from '../components/UpdateReminder/hooks';
4747
import useAppNavigation from '../hooks/useAppNavigation';
4848
import { useOnLock } from '../hooks/useOnLock';
49+
import { useReactScan } from '../hooks/useReactScan';
4950
import {
5051
isOpenedReferFriendsPage,
5152
useReferFriends,
@@ -55,8 +56,6 @@ import {
5556
useToMyOneKeyModal,
5657
} from '../views/DeviceManagement/hooks/useToMyOneKeyModal';
5758

58-
import { useReactScan } from './hooks/useReactScan';
59-
6059
import type { IntlShape } from 'react-intl';
6160

6261
const useOnLockCallback = platformEnv.isDesktop

0 commit comments

Comments
 (0)