Conversation
|
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
apps/web-tdesign/src/adapter/component/index.ts
| let ghost = false; | ||
| let variant = props.variant; | ||
| if (props.variant === 'ghost') { | ||
| ghost = true; | ||
| variant = 'base'; | ||
| } |
There was a problem hiding this comment.
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).
|
Could you please update the PR title to make it more precise? |
[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