InputMenu, SelectMenu, CommandPalette, Listbox: load the virtualizer only when `virtualize` is set

Aperta
#7,369 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Start by reading InputMenu.vue, then inspect how SelectMenu.vue, CommandPalette.vue, and Listbox.vue import and render Reka UI virtualizer components. Check the build output to confirm the virtualizer and TanStack Virtual are split into a separately requested chunk when virtualize is enabled. Done means apps without virtualize no longer preload that chunk, while virtualized menus still work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

triage
Package

v4.x

Environment
  • @nuxt/ui: 4.12.0
  • reka-ui: 2.11.0
  • @tanstack/vue-virtual: 3.13.51
  • @tanstack/virtual-core: 3.19.10
  • Nuxt 4.6.4, Vite 8 (rolldown)
Description

InputMenu.vue imports ComboboxVirtualizer and AutocompleteVirtualizer from reka-ui statically. It renders them only when virtualize is set:

<template v-if="!!props.virtualize">
  <Component.Virtualizer …>

Because the import is static, every app that uses UInputMenu ships reka-ui's ListboxVirtualizer, together with @tanstack/vue-virtual and @tanstack/virtual-core, even when it never virtualizes. SelectMenu.vue, CommandPalette.vue and Listbox.vue follow the same pattern.

In our app, a search bar built on UInputMenu is present on every page, without virtualize:

  • The chunk that holds the virtualizer weighs about 15 KB brotli, of which @tanstack/virtual-core accounts for about 9.5 KB.
  • It is preloaded (modulepreload) on every page.
  • Coverage shows only 13 % of it executed at load, which is module initialization only.
Suggested change

Load the virtualizer components only when virtualize is set, so that bundlers put them, and TanStack Virtual, in a chunk of their own that is requested on demand.

Workaround

None that is clean on the app side: aliasing reka-ui's virtualizer to a stub would break with each update.

Additional context

No response

Lingua principale
TypeScript
Stelle
7.1k
Fork
1.2k
Merge medio
1g 2h
PR unite (30g)
147

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nuxt/ui

Tutte le issue di nuxt/ui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.