Delete <AppProfiler>
This commit is contained in:
@@ -69,7 +69,6 @@ import {NuxDialogs} from '#/components/dialogs/nuxs'
|
|||||||
import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
|
import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
|
||||||
import {Provider as IntentDialogProvider} from '#/components/intents/IntentDialogs'
|
import {Provider as IntentDialogProvider} from '#/components/intents/IntentDialogs'
|
||||||
import {Provider as PortalProvider} from '#/components/Portal'
|
import {Provider as PortalProvider} from '#/components/Portal'
|
||||||
import {AppProfiler} from '#/AppProfiler'
|
|
||||||
import {Splash} from '#/Splash'
|
import {Splash} from '#/Splash'
|
||||||
import {BottomSheetProvider} from '../modules/bottom-sheet'
|
import {BottomSheetProvider} from '../modules/bottom-sheet'
|
||||||
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||||
@@ -198,7 +197,6 @@ function App() {
|
|||||||
* that is set up in the InnerApp component above.
|
* that is set up in the InnerApp component above.
|
||||||
*/
|
*/
|
||||||
return (
|
return (
|
||||||
<AppProfiler>
|
|
||||||
<GeolocationProvider>
|
<GeolocationProvider>
|
||||||
<A11yProvider>
|
<A11yProvider>
|
||||||
<KeyboardControllerProvider>
|
<KeyboardControllerProvider>
|
||||||
@@ -235,7 +233,6 @@ function App() {
|
|||||||
</KeyboardControllerProvider>
|
</KeyboardControllerProvider>
|
||||||
</A11yProvider>
|
</A11yProvider>
|
||||||
</GeolocationProvider>
|
</GeolocationProvider>
|
||||||
</AppProfiler>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
import React, {Profiler} from 'react'
|
|
||||||
|
|
||||||
// Don't let it get stripped out in profiling builds (which apply production Babel preset).
|
|
||||||
const log = (global as any)['con' + 'sole'].log
|
|
||||||
|
|
||||||
function onRender(id: string, phase: string, actualDuration: number) {
|
|
||||||
if (!__DEV__) {
|
|
||||||
// This block of code will exist in the production build of the app.
|
|
||||||
// However, only profiling builds of React call `onRender` so it's dead code in actual production.
|
|
||||||
const message = `<Profiler> ${id}:${phase} ${
|
|
||||||
actualDuration > 500
|
|
||||||
? '(╯°□°)╯ '
|
|
||||||
: actualDuration > 100
|
|
||||||
? '[!!] '
|
|
||||||
: actualDuration > 16
|
|
||||||
? '[!] '
|
|
||||||
: ''
|
|
||||||
}${Math.round(actualDuration)}ms`
|
|
||||||
log(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AppProfiler({children}: {children: React.ReactNode}) {
|
|
||||||
return (
|
|
||||||
<Profiler id="app" onRender={onRender}>
|
|
||||||
{children}
|
|
||||||
</Profiler>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user