-
Notifications
You must be signed in to change notification settings - Fork 98
perf: replace FlexFrame pair in QueuedMessagesDrawer with widthCap (LUM-1011) #26220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,7 @@ struct QueuedMessagesDrawer: View { | |
| .strokeBorder(VColor.borderBase, lineWidth: 1) | ||
| ) | ||
| .fixedSize(horizontal: false, vertical: true) | ||
| .frame(maxWidth: VSpacing.chatColumnMaxWidth) | ||
| .frame(maxWidth: .infinity, alignment: .center) | ||
| .widthCap(VSpacing.chatColumnMaxWidth) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 FlexFrame rule may not apply outside LazyVStack The Was this helpful? React with 👍 or 👎 to provide feedback.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The FlexFrame cascade is not specific to The Sentry stack for MACOS-G (issue 7327550173) is: That cascade doesn't require the nodes to be inside a lazy container — The task specifically identified this drawer as the residual hang site (CEO reported the hang with queued messages visible, matching MACOS-G's 24 new 0.6.4 events) and noted the drawer's two nested AGENTS.md updated this framing in PR #26092:
So the rule's motivation extends beyond |
||
| } | ||
|
|
||
| private func header(queuedMessages: [ChatMessage]) -> some View { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Centering alignment lost when replacing
.framepair with.widthCapThe old code used a two-modifier pattern:
.frame(maxWidth: VSpacing.chatColumnMaxWidth)to cap the width, followed by.frame(maxWidth: .infinity, alignment: .center)to expand to fill available space and center the capped content within it. The replacement.widthCap(VSpacing.chatColumnMaxWidth)only caps the width —WidthCapLayoutplaces content at.topLeading(clients/shared/DesignSystem/Modifiers/WidthCapLayout.swift:26-27) and reportsmin(cap, available)as its own size (WidthCapLayout.swift:21), so it never expands beyond the cap. The drawer will appear leading-aligned instead of centered when wired into the chat view. Since the component comment says "Not yet wired into ChatView" this doesn't affect any current UI, but the intended centering behavior from the original code is lost.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traced the layout — centering is preserved.
QueuedMessagesDrawerrenders insideactiveConversationContent'sVStack(spacing: 0)(<ref_snippet file="/home/ubuntu/repos/vellum-assistant/clients/macos/vellum-assistant/Features/Chat/ChatView.swift" lines="351-510" />), which has no explicit horizontal alignment — so it defaults to.center. Other children of that VStack (all banners plus the composer) are wrapped incenteredChatColumn(width:), which usesHStack(spacing: 0) { Spacer(); content.frame(width:); Spacer() }— the Spacers expand it to the full container width. That forces the VStack's own width to the full container width. With VStack width = container width, drawer width =min(cap, available), and VStack's default.centerhorizontal alignment, the drawer is positioned centered within the VStack.The stale
// Not yet wired into ChatViewdocstring on the struct is out of date — the drawer IS wired up at <ref_snippet file="/home/ubuntu/repos/vellum-assistant/clients/macos/vellum-assistant/Features/Chat/ChatView.swift" lines="444-451" />. I'll clean up that doc comment in a follow-up so it doesn't mislead future readers.Reinstating
.frame(maxWidth: .infinity, alignment: .center)would re-create_FlexFrameLayoutand reintroduce the alignment cascade this PR is fixing. Keeping.widthCap(...)and relying on the parent VStack's default.centeralignment is the correct fix.CI skips macOS builds — I'll note in the PR description that Ashlee needs to visually confirm centering on a local Xcode build before merge.