perf: load screens that aren't on the way to the inbox on first visit

This commit is contained in:
Linus Rath
2026-10-22 22:04:33 +02:00
parent 0c8b8179b2
commit d13769a9f2
+10 -16
View File
@@ -43,20 +43,14 @@ import { addUnifiedPushEndpointListener } from './src/lib/unified-push';
// Pause between a mute change and the push-filter update it sends (#78). // Pause between a mute change and the push-filter update it sends (#78).
const MUTES_RESYNC_DELAY_MS = 1_000; const MUTES_RESYNC_DELAY_MS = 1_000;
import type { MainTabsParamList, RootStackParamList } from './src/navigation/types'; import type { MainTabsParamList, RootStackParamList } from './src/navigation/types';
import ComposeScreen from './src/screens/ComposeScreen';
import EmailThreadScreen from './src/screens/EmailThreadScreen'; import EmailThreadScreen from './src/screens/EmailThreadScreen';
import EmailSourceScreen from './src/screens/EmailSourceScreen';
import LoginScreen from './src/screens/LoginScreen'; import LoginScreen from './src/screens/LoginScreen';
import MailTab from './src/screens/MailTab'; import MailTab from './src/screens/MailTab';
import FilesScreen from './src/screens/FilesScreen';
import CalendarScreen from './src/screens/CalendarScreen';
import ContactsTab from './src/screens/ContactsTab';
import ContactDetailScreen from './src/screens/ContactDetailScreen'; import ContactDetailScreen from './src/screens/ContactDetailScreen';
import ContactFormScreen from './src/screens/ContactFormScreen';
import GroupDetailScreen from './src/screens/GroupDetailScreen'; import GroupDetailScreen from './src/screens/GroupDetailScreen';
import SettingsScreen from './src/screens/SettingsScreen'; import SettingsScreen from './src/screens/SettingsScreen';
import ScheduledScreen from './src/screens/ScheduledScreen'; // Screens that aren't on the way to the inbox load on first visit
import UnifiedInboxScreen from './src/screens/UnifiedInboxScreen'; // (getComponent below), so their modules stay out of the startup work.
import { useAccountStore } from './src/stores/account-store'; import { useAccountStore } from './src/stores/account-store';
import { useAuthStore } from './src/stores/auth-store'; import { useAuthStore } from './src/stores/auth-store';
import { useCalendarStore } from './src/stores/calendar-store'; import { useCalendarStore } from './src/stores/calendar-store';
@@ -323,7 +317,7 @@ function MainTabsNavigator({ navigation }: NativeStackScreenProps<RootStackParam
</Tab.Screen> </Tab.Screen>
<Tab.Screen <Tab.Screen
name="Calendar" name="Calendar"
component={CalendarScreen} getComponent={() => require('./src/screens/CalendarScreen').default}
options={{ options={{
title: tabLabels.calendar, title: tabLabels.calendar,
tabBarButtonTestID: 'tab-calendar', tabBarButtonTestID: 'tab-calendar',
@@ -339,7 +333,7 @@ function MainTabsNavigator({ navigation }: NativeStackScreenProps<RootStackParam
/> />
<Tab.Screen <Tab.Screen
name="Contacts" name="Contacts"
component={ContactsTab} getComponent={() => require('./src/screens/ContactsTab').default}
options={{ options={{
title: tabLabels.contacts, title: tabLabels.contacts,
tabBarButtonTestID: 'tab-contacts', tabBarButtonTestID: 'tab-contacts',
@@ -355,7 +349,7 @@ function MainTabsNavigator({ navigation }: NativeStackScreenProps<RootStackParam
/> />
<Tab.Screen <Tab.Screen
name="Files" name="Files"
component={FilesScreen} getComponent={() => require('./src/screens/FilesScreen').default}
options={{ options={{
title: tabLabels.files, title: tabLabels.files,
tabBarButtonTestID: 'tab-files', tabBarButtonTestID: 'tab-files',
@@ -873,10 +867,10 @@ export default function App() {
<Stack.Navigator screenOptions={{ headerShown: false, freezeOnBlur: true }} screenLayout={withHosts}> <Stack.Navigator screenOptions={{ headerShown: false, freezeOnBlur: true }} screenLayout={withHosts}>
<Stack.Screen name="MainTabs" component={MainTabsNavigator} /> <Stack.Screen name="MainTabs" component={MainTabsNavigator} />
<Stack.Screen name="EmailThread" component={EmailThreadScreen} /> <Stack.Screen name="EmailThread" component={EmailThreadScreen} />
<Stack.Screen name="EmailSource" component={EmailSourceScreen} /> <Stack.Screen name="EmailSource" getComponent={() => require('./src/screens/EmailSourceScreen').default} />
<Stack.Screen <Stack.Screen
name="Compose" name="Compose"
component={ComposeScreen} getComponent={() => require('./src/screens/ComposeScreen').default}
// A tablet shows the composer as a panel over the screen it came // A tablet shows the composer as a panel over the screen it came
// from, so that screen stays drawn behind the dimmed backdrop. // from, so that screen stays drawn behind the dimmed backdrop.
options={isSplit options={isSplit
@@ -886,15 +880,15 @@ export default function App() {
<Stack.Screen name="ContactDetail" component={ContactDetailScreen} /> <Stack.Screen name="ContactDetail" component={ContactDetailScreen} />
<Stack.Screen <Stack.Screen
name="ContactForm" name="ContactForm"
component={ContactFormScreen} getComponent={() => require('./src/screens/ContactFormScreen').default}
options={{ options={{
presentation: 'modal', presentation: 'modal',
animation: 'slide_from_bottom', animation: 'slide_from_bottom',
}} }}
/> />
<Stack.Screen name="GroupDetail" component={GroupDetailScreen} /> <Stack.Screen name="GroupDetail" component={GroupDetailScreen} />
<Stack.Screen name="Scheduled" component={ScheduledScreen} /> <Stack.Screen name="Scheduled" getComponent={() => require('./src/screens/ScheduledScreen').default} />
<Stack.Screen name="UnifiedInbox" component={UnifiedInboxScreen} /> <Stack.Screen name="UnifiedInbox" getComponent={() => require('./src/screens/UnifiedInboxScreen').default} />
<Stack.Screen <Stack.Screen
name="AddAccount" name="AddAccount"
options={{ options={{