[AGE-3766] feat(frontend): Make collapse headers sticky in PrettyJsonView#4574
[AGE-3766] feat(frontend): Make collapse headers sticky in PrettyJsonView#4574Sanket2329 wants to merge 2 commits into
Conversation
|
@Sanket2329 is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR threads a numeric ChangesJSON View Depth-Based Layout
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/oss/src/components/DrillInView/TraceSpanDrillInView.tsx (1)
656-658:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winFix broken entity type assertion identifiers (build blocker).
Line 656 references
traceSpan(undefined), and Line 657 referencestraceSpanMoleculeMolecule(typo/undefined). This won’t type-check/compile.💡 Proposed fix
- const entityWithDrillIn = traceSpan as typeof traceSpanMolecule & { - drillIn: NonNullable<typeof traceSpanMoleculeMolecule.drillIn> + const entityWithDrillIn = traceSpanMolecule as typeof traceSpanMolecule & { + drillIn: NonNullable<typeof traceSpanMolecule.drillIn> }
🧹 Nitpick comments (1)
web/oss/src/components/DrillInView/PrettyJsonView.tsx (1)
597-599: ⚡ Quick winExtract row height into a shared constant to prevent sticky-offset drift.
Line 597 hardcodes
h-[28px]/min-h-[28px]while Line 598 separately hardcodesdepth * 28. A future style tweak can silently break sticky alignment.Proposed refactor
+const ROW_HEIGHT_PX = 28 +const ROW_HEIGHT_CLASS = "min-h-[28px] h-[28px]" + const NodeRow = memo(function NodeRow({ ... - className={`group/row flex items-baseline gap-2 py-0.5 px-1 rounded-sm min-h-[28px] h-[28px] select-none ${collapsible ? "cursor-pointer sticky z-[1] bg-[var(--ant-color-bg-container)]" : ""} hover:bg-[var(--ant-color-fill-quaternary)] focus-visible:ring-1 focus-visible:ring-[var(--ant-color-primary)] focus-visible:outline-none`} - style={collapsible ? {top: `${depth * 28}px`} : undefined} + className={`group/row flex items-baseline gap-2 py-0.5 px-1 rounded-sm ${ROW_HEIGHT_CLASS} select-none ${collapsible ? "cursor-pointer sticky z-[1] bg-[var(--ant-color-bg-container)]" : ""} hover:bg-[var(--ant-color-fill-quaternary)] focus-visible:ring-1 focus-visible:ring-[var(--ant-color-primary)] focus-visible:outline-none`} + style={collapsible ? {top: `${depth * ROW_HEIGHT_PX}px`} : undefined}
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 93db98ae-a23f-4ca8-ac70-ef47d727c0be
📒 Files selected for processing (2)
web/oss/src/components/DrillInView/PrettyJsonView.tsxweb/oss/src/components/DrillInView/TraceSpanDrillInView.tsx
Context
When scrolling through large JSON objects in the trace span detail view (
PrettyJsonView), the collapsible headers and context actions (such as copying or collapsing parent sections) would scroll out of the viewport. This made it difficult to keep track of the current path and perform collapse/copy operations on parent levels.Changes
PrettyJsonView.tsxto pass adepthproperty down the JSON tree rendering nodes.NodeRowto acceptdepthand dynamically setstyle={{top:${depth * 28}px}}for sticky header positioning, using a precise row height of28px(h-[28px] min-h-[28px] py-0.5).CopyButtonvertically inside the fixed-height row usingself-center.overflow-hiddenandoverflow-y-autostyle properties from wrapper elements inTraceSpanDrillInView.tsxthat previously broke the CSS sticky positioning context.Tests / notes
pnpm lint-fixwithin thewebfolder to ensure all TypeScript and React code formatting and rules pass successfully.