Skip to content

fix bug#7715

Merged
jinmao88 merged 1 commit intovbenjs:mainfrom
Voidlurk:fix-default
Mar 24, 2026
Merged

fix bug#7715
jinmao88 merged 1 commit intovbenjs:mainfrom
Voidlurk:fix-default

Conversation

@Voidlurk
Copy link
Contributor

@Voidlurk Voidlurk commented Mar 23, 2026

[Vue warn]: Invalid prop: custom validator check failed for prop "variant". 02:48:13
at <TButton variant="ghost" disabled=false onClick=fn ... >
at <AsyncComponentWrapper variant="ghost" disabled=false onClick=fn ... >
at <DefaultButton key=0 variant="ghost" disabled=false ... >
at
at <Primitive ref=fn as-child=false as=undefined ... >
at <DismissableLayer tabindex="-1" onKeydown=fn style= {"position":"fixed"} ... >
at <PrimitiveSlot tabindex="-1" onKeydown=fn style= {"position":"fixed"} ... >
at <Primitive ref_key="currentRef" ref=Ref< {"asChild":true,"as":"div"} > tabindex="-1" ... >
at <FocusScope as-child="" loop="" trapped=false ... >
at <DialogContentImpl as=undefined forceMount=false trapFocus=false ... >
at <DialogContentNonModal key=1 ref=fn forceMount=false ... >
at <Presence present=true style= {"position":"fixed"} onAnimationend=fn ... >
at <DialogContent ref="contentRef" style= {"position":"fixed"} onAnimationend=fn ... >
at <DialogContent ref="contentRef" append-to=undefined class="inset-x-0 mx-auto flex max-h-[80%] w-130 flex-col p-0 sm:rounded-(--radius) border border-border top-1/2 duration-300" ... >
at
at
at <Modal cancel-text="取消" confirm-text="确认" fullscreen-button=false ... >
at <VbenModal cancel-text="取消" confirm-text="确认" fullscreen-button=false ... >
at <UserDropdown avatar="https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp" menus= [{"icon":"lucide:user","text":"个人中心"},{"text":"文档"},{"icon":{"name":"Icon-svg:github"},"text":"GitHub"},{"text":"问题 & 帮助"}] text="Vben" ... >
at <LayoutHeader theme="dark" onClearPreferencesAndLogout=fn >
at <LayoutHeader key=0 full-width=false height=50 ... >
at <VbenLayout sidebar-extra-visible=true onUpdate:sidebarExtraVisible=fn content-compact="wide" ... >
at <BasicLayout onClearPreferencesAndLogout=fn >
at <Basic onVnodeUnmounted=fn ref=Ref< {} > >

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the rendering of ghost-styled buttons to ensure proper visual presentation and correct styling application.

[Vue warn]: Invalid prop: custom validator check failed for prop "variant".
@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2026

⚠️ No Changeset found

Latest commit: 0a819df

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

The DefaultButton component adapter was updated to remap the "ghost" variant. When the variant prop equals "ghost", the adapter now sets ghost = true and forces variant = 'base', then passes both properties to the underlying tdesign-vue-next Button component.

Changes

Cohort / File(s) Summary
DefaultButton Adapter
apps/web-tdesign/src/adapter/component/index.ts
Added logic to remap "ghost" variant by setting ghost = true and forcing variant = 'base', ensuring the remapped properties are passed to the rendered Button component.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • anncwb
  • vince292007
  • jinmao88

Poem

🐰 A ghostly button once did roam,
With variant lost and far from home,
But now it shifts with gentle care,
From "ghost" to "base" beyond compare—
A specter's form, a solid stance,
Where styling takes its rightful dance! ✨

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains a Vue error stack trace without explaining the root cause, the fix applied, or following the repository's description template structure. Add a proper description following the template: explain the bug, describe the fix applied in the code, check the type of change checkbox, and complete the checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix bug' is too vague and generic, lacking specificity about what bug is being fixed or what component/feature is affected. Replace with a descriptive title that identifies the specific issue, such as 'Fix DefaultButton ghost variant validation error' or similar.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web-tdesign/src/adapter/component/index.ts`:
- Around line 168-173: The current logic unconditionally sets ghost = false then
overrides it, which discards an explicit props.ghost passed by callers; update
the initialization to preserve props.ghost (e.g., ghost = props.ghost ?? false)
and only force ghost = true when props.variant === 'ghost' while still setting
variant = 'base' in that case; ensure no later code unconditionally resets ghost
to false. Target the ghost and variant handling around the block using
props.variant and props.ghost in this file (the variables named ghost and
variant).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1246d56-d0c8-4b36-917c-ca394eeaa335

📥 Commits

Reviewing files that changed from the base of the PR and between 3528517 and 0a819df.

📒 Files selected for processing (1)
  • apps/web-tdesign/src/adapter/component/index.ts

Comment on lines +168 to +173
let ghost = false;
let variant = props.variant;
if (props.variant === 'ghost') {
ghost = true;
variant = 'base';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Preserve explicit ghost input instead of forcing false.

At Line 168 and Line 176, ghost defaults to false and then overrides incoming props.ghost. That breaks callers explicitly passing ghost: true when variant !== 'ghost'.

Proposed fix
-      let ghost = false;
-      let variant = props.variant;
-      if (props.variant === 'ghost') {
-        ghost = true;
-        variant = 'base';
-      }
+      const isGhostVariant = props.variant === 'ghost';
+      const ghost = isGhostVariant || Boolean(props.ghost);
+      const variant = isGhostVariant ? 'base' : props.variant;

Also applies to: 176-176

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web-tdesign/src/adapter/component/index.ts` around lines 168 - 173, The
current logic unconditionally sets ghost = false then overrides it, which
discards an explicit props.ghost passed by callers; update the initialization to
preserve props.ghost (e.g., ghost = props.ghost ?? false) and only force ghost =
true when props.variant === 'ghost' while still setting variant = 'base' in that
case; ensure no later code unconditionally resets ghost to false. Target the
ghost and variant handling around the block using props.variant and props.ghost
in this file (the variables named ghost and variant).

@doraemonxxx
Copy link

Could you please update the PR title to make it more precise?

@jinmao88 jinmao88 merged commit 4c1e3b9 into vbenjs:main Mar 24, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants