about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2023-11-01 15:31:33 +0000
committerGitHub <noreply@github.com>2023-11-01 15:31:33 +0000
commit85c26fb5a8eef0c60aba1b27d8d516034a7e508e (patch)
tree14ed36fb31c88f3cd4cff4d7bd347c73c17f7e0c /src
parentadb5ce29614e21e1f061fb4be9c4a7887d0b6869 (diff)
downloadvoidsky-85c26fb5a8eef0c60aba1b27d8d516034a7e508e.tar.zst
Instrument module init in DEV (#1787)
Diffstat (limited to 'src')
-rw-r--r--src/Navigation.tsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Navigation.tsx b/src/Navigation.tsx
index a75651987..e481d966e 100644
--- a/src/Navigation.tsx
+++ b/src/Navigation.tsx
@@ -472,6 +472,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
           performance.now() - global.__BUNDLE_START_TIME__,
         )
         console.log(`Time to first paint: ${initMs} ms`)
+        logModuleInitTrace()
 
         // Register the navigation container with the Sentry instrumentation (only works on native)
         if (isNative) {
@@ -586,6 +587,18 @@ const styles = StyleSheet.create({
   },
 })
 
+function logModuleInitTrace() {
+  if (__DEV__) {
+    // This log is noisy, so keep false committed
+    const shouldLog = false
+    // Relies on our patch to polyfill.js in metro-runtime
+    const initLogs = (global as any).__INIT_LOGS__
+    if (shouldLog && Array.isArray(initLogs)) {
+      console.log(initLogs.join('\n'))
+    }
+  }
+}
+
 export {
   navigate,
   resetToTab,