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

オープン
#7,369 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
7.1k
フォーク
1.2k
平均マージ
1日 2時間
マージ済み PR(30日)
147

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nuxt/ui のほかの issue

nuxt/ui の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。