fix(sub-block): render tooltip field as Info icon in label#4703
fix(sub-block): render tooltip field as Info icon in label#4703serhiizghama wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit bf99932. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR fixes a long-standing gap where
Confidence Score: 5/5Safe to merge — the change is additive, touches only the label render path, and is conditionally active only when a block config sets The implementation exactly mirrors the existing AlertTriangle tooltip pattern in the same function: same Tooltip.Root/Trigger/Content structure, same asChild + span wrapper, same icon sizing. No state, no new dependencies, and no change to existing rendering when config.tooltip is absent. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[renderLabel called] --> B{config.title?}
B -- No --> Z[return null]
B -- Yes --> C[Render Label element]
C --> D{isSearchHighlighted?}
D -- Yes --> E[Render highlighted mark]
D -- No --> F[Render plain title text]
E --> G{required?}
F --> G
G -- Yes --> H[Render asterisk span]
G -- No --> I{config.tooltip?}
H --> I
I -- Yes --> J[Render Info icon + Tooltip.Root]
I -- No --> K[Render labelSuffix]
J --> K
K --> L{code type + invalid JSON?}
L -- Yes --> M[Render AlertTriangle + Tooltip.Root]
L -- No --> N[Render action buttons wand/copy/etc.]
M --> N
Reviews (1): Last reviewed commit: "fix(sub-block): render tooltip field as ..." | Re-trigger Greptile |
Problem
SubBlockConfig.tooltipis defined inblocks/types.tsbut was never rendered in therenderLabelfunction ofsub-block.tsx. Addingtooltip: 'some help text'to any sub-block definition had no visible effect in the UI.Solution
Added an
Infoicon fromlucide-reactthat appears inline next to the field label (after the required asterisk). Hovering it shows the tooltip text via the existingTooltip.Root/Trigger/Contentpattern already used in the same file.The tooltip renders inside the
<Label>element, consistent with how the invalid-JSONAlertTrianglewarning is handled in the same function.Testing
tooltip: 'some help text'to any sub-block definition in a block configInfoicon appears next to the field labelCloses #4071