Skip to content

fix(InputMenu/Select/SelectMenu): exclude cosmetic items from model value type#6044

Merged
benjamincanac merged 8 commits intov4from
fix/exclude-known-types-from-model-values
Feb 16, 2026
Merged

fix(InputMenu/Select/SelectMenu): exclude cosmetic items from model value type#6044
benjamincanac merged 8 commits intov4from
fix/exclude-known-types-from-model-values

Conversation

@sandros94
Copy link
Member

Some components like InputMenu, SelectMenu and Select support for items that are purely cosmetic like type: 'label' and type: 'separator'.

This causes a waterfall of type issues

@sandros94 sandros94 self-assigned this Feb 15, 2026
@sandros94 sandros94 added bug Something isn't working typescript v4 #4488 p3-low Minor cosmetic, edge case, or documentation issue labels Feb 15, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

📝 Walkthrough

Walkthrough

This pull request updates type handling and narrow-cases across input and select components and shared types. Components (Input.vue, Textarea.vue) tighten when modelModifiers.optional can coerce values to undefined by requiring nullable to be false and the current value non-null. Menu/select components (InputMenu.vue, Select.vue, SelectMenu.vue) introduce an internal ExcludeItem type and thread it through props, emits, slots, and helper typings to exclude label/separator item shapes from model values. Utility types in utils.ts are refactored to add an optional O parameter propagated through GetItemValue, GetModelValue, and GetModelValueEmits. input.ts adjusts ModelModifiers conditional defaults.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, explaining the motivation behind excluding cosmetic item types from model-value types to resolve type issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into v4
Title check ✅ Passed The title accurately reflects the main change: excluding cosmetic items from model value types in InputMenu, Select, and SelectMenu components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/exclude-known-types-from-model-values

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/runtime/components/SelectMenu.vue (1)

37-38: Naming inconsistency: ExcludeMenuItem here vs ExcludeItem in Select.vue.

Select.vue defines type ExcludeItem = { type: 'label' | 'separator' } while SelectMenu.vue and InputMenu.vue use ExcludeMenuItem. Since these are file-local types with identical shapes, this isn't a bug, but unifying the name (e.g., all ExcludeItem) would reduce cognitive overhead when navigating between components.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 15, 2026

npm i https://pkg.pr.new/@nuxt/ui@6044

commit: 554507a

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/runtime/components/SelectMenu.vue (1)

37-37: Extract ExcludeItem to shared types.

This type is identically defined in Select.vue, SelectMenu.vue, and InputMenu.vue. Move it to src/runtime/types/utils.ts where the components already import shared generics like GetItemValue and GetModelValue, eliminating duplication and establishing a single source of truth.

@benjamincanac benjamincanac removed p3-low Minor cosmetic, edge case, or documentation issue bug Something isn't working labels Feb 16, 2026
@benjamincanac benjamincanac changed the title type(InputMenu|SelectMenu|Select): exclude cosmetic items from model-value type fix(InputMenu/Select/SelectMenu): exclude cosmetic items from model value type Feb 16, 2026
@benjamincanac benjamincanac merged commit 22cf1ea into v4 Feb 16, 2026
18 checks passed
@benjamincanac benjamincanac deleted the fix/exclude-known-types-from-model-values branch February 16, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments