️(frontend) use a more direct read for the username from localStorage

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.
This commit is contained in:
lebaudantoine
2026-05-27 12:53:41 +02:00
committed by aleb_the_flash
parent 09b7a23f51
commit 6378c1e384
@@ -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()