From 6378c1e3847216001e3f3850f0155fdd85b610e5 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 27 May 2026 12:53:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(frontend)=20use=20a=20more?= =?UTF-8?q?=20direct=20read=20for=20the=20username=20from=20localStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The homepage previously relied on the userChoices store, which loads the persisted user choices from localStorage. However, this store is widely used in the room feature, so code splitting ended up loading the chunk containing the userChoices store at the initial render. That chunk was bundled with unrelated parts that proved to be heavy. Switch to a more straightforward approach reading the cached username and verify the bundle output + intial loading. Saves a few hundred ko on the initial load, now bundled in another chunk that is loaded only when entering a room. --- src/frontend/src/features/home/routes/Home.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/features/home/routes/Home.tsx b/src/frontend/src/features/home/routes/Home.tsx index cc2f7f28..aad6cfb4 100644 --- a/src/frontend/src/features/home/routes/Home.tsx +++ b/src/frontend/src/features/home/routes/Home.tsx @@ -20,8 +20,7 @@ import { useConfig } from '@/api/useConfig' import { LoginButton } from '@/components/LoginButton' import { ApiRoom } from '@/features/rooms/api/ApiRoom' import { LoadingScreen } from '@/components/LoadingScreen' -import { useSnapshot } from 'valtio' -import { userChoicesStore } from '@/stores/userChoices' +import { loadUserChoices } from '@livekit/components-core' const Columns = ({ children }: { children?: ReactNode }) => { return ( @@ -149,7 +148,7 @@ const IntroText = styled('div', { }) const CreateMeetingMenu = () => { - const { username } = useSnapshot(userChoicesStore) + const { username } = loadUserChoices() const { t } = useTranslation('home') const { mutateAsync: createRoom } = useCreateRoom()