perf(react): remove lazy imports again
Some checks failed
/ build-web (push) Successful in 4m52s
/ build-mobile (push) Failing after 8m36s
/ build-desktop (linux) (push) Successful in 7m46s
/ release (push) Has been skipped

This commit is contained in:
Alois 2026-08-31 23:09:02 +02:00
commit e0c2331af3
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
8 changed files with 82 additions and 121 deletions

View file

@ -1,15 +1,8 @@
import { lazy, Suspense } from "react";
import { useCall } from "@tensamin/call/state";
const Popout = lazy(() => import("@tensamin/call/popout"));
import Popout from "@tensamin/call/popout";
export default function CallPopout() {
const active = useCall((state) => state.state !== "closed");
return active ? (
<Suspense fallback={null}>
<Popout />
</Suspense>
) : null;
return active ? <Popout /> : null;
}

View file

@ -1,15 +1,8 @@
import { lazy, Suspense } from "react";
import { useCall } from "@tensamin/call/state";
const SidebarBox = lazy(() => import("@tensamin/call/sidebarBox"));
import SidebarBox from "@tensamin/call/sidebarBox";
export default function CallSidebarBox() {
const active = useCall((state) => state.state !== "closed");
return active ? (
<Suspense fallback={null}>
<SidebarBox />
</Suspense>
) : null;
return active ? <SidebarBox /> : null;
}

View file

@ -28,6 +28,7 @@ import { useState } from "react";
import { SidebarTrigger, useSidebar } from "@methanium/ui";
import { WindowControls as Controls } from "@methanium/ui";
import { useSession } from "@tensamin/identity/session";
import { joinCall } from "@tensamin/call/store";
import Profile from "./modals/profile";
export default function Navbar({ forMobile }: { forMobile: boolean }) {
@ -139,11 +140,7 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) {
{currentCalls.length === 0 ? (
<Button
disabled={callState !== "closed"}
onClick={() => {
void import("@tensamin/call/store").then(({ joinCall }) =>
joinCall(id),
);
}}
onClick={() => void joinCall(id)}
className="w-9 h-9! aspect-square rounded-lg"
variant="outline"
>
@ -153,12 +150,10 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) {
<Button
disabled={callState !== "closed"}
onClick={() => {
void import("@tensamin/call/store").then(({ joinCall }) =>
joinCall(
id,
currentCalls[0].CallSecret,
currentCalls[0].CallId,
),
void joinCall(
id,
currentCalls[0].CallSecret,
currentCalls[0].CallId,
);
}}
className="w-9 h-9! aspect-square rounded-lg"
@ -185,12 +180,9 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) {
<SelectItem
value={call.CallId}
key={call.CallId}
onSelect={() => {
void import("@tensamin/call/store").then(
({ joinCall }) =>
joinCall(id, call.CallSecret, call.CallId),
);
}}
onSelect={() =>
void joinCall(id, call.CallSecret, call.CallId)
}
>
{displayCallId(call.CallId)}
</SelectItem>

View file

@ -13,8 +13,13 @@ import "@methanium/ui/index.css";
import NotFound from "@/routes/404";
import RouteLoader from "@/components/routeLoader";
import Home from "@/routes/app/home";
import AppShell from "@/routes/app/shell";
import Login from "@/routes/screens/login";
import { createSettingsRoute } from "@tensamin/settings";
import ChatScreen from "@tensamin/chat/screen";
import CallScreen from "@tensamin/call/screen";
import DeeplinkContext from "@tensamin/tauri/deeplinkHandler";
import PwaRuntime from "@tensamin/pwa/runtime";
@ -22,14 +27,7 @@ import PwaRuntime from "@tensamin/pwa/runtime";
import { ErrorScreen, ThemeProvider, useTheme } from "@methanium/ui";
import z from "zod";
import {
lazy,
Suspense,
useEffect,
useRef,
useState,
type ReactNode,
} from "react";
import { useEffect, useRef, useState, type ReactNode } from "react";
import Storage from "@tensamin/storage/context";
import { log } from "@tensamin/shared/log";
@ -39,13 +37,6 @@ import { useLocation, useNavigate } from "@tanstack/react-router";
import { useIsMobile, Toaster, TooltipProvider } from "@methanium/ui";
import { HotkeysProvider } from "@tensamin/hotkeys";
const Home = lazy(() => import("@/routes/app/home"));
const ChatScreen = lazy(() => import("@tensamin/chat/screen"));
const CallScreen = lazy(() => import("@tensamin/call/screen"));
const Login = lazy(() => import("@/routes/screens/login"));
const appShellImport = import("@/routes/app/shell");
const AppShell = lazy(() => appShellImport);
const wrapper = document.getElementById("root");
if (!wrapper) {
@ -260,9 +251,7 @@ function RootShell() {
<HotkeysProvider>
<ThemeStorageBridge />
<LoginWrapper>
<Suspense fallback={<RouteLoader />}>
<Outlet />
</Suspense>
<Outlet />
</LoginWrapper>
</HotkeysProvider>
</Storage>

View file

@ -1,7 +1,6 @@
import { Suspense, useEffect, useRef } from "react";
import { useEffect, useRef } from "react";
import { Outlet, useNavigate } from "@tanstack/react-router";
import RouteLoader from "@/components/routeLoader";
import AppLayout from "./layout";
import CallInit from "@/components/callRuntimeInit";
import CacheSync from "@tensamin/cache/sync";
@ -61,9 +60,7 @@ export default function AppShell() {
<AppLayout>
<ChatContext>
<NotificationsProvider>
<Suspense fallback={<RouteLoader />}>
<Outlet />
</Suspense>
<Outlet />
</NotificationsProvider>
</ChatContext>
</AppLayout>