Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions clients/macos/vellum-assistant/Features/Chat/UsedToolsList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ private struct UsedToolsRow: View {
}
}
.animation(VAnimation.fast, value: isExpanded)
.onChange(of: isExpanded) { newValue in
// Populate the cache *before* the expanded body evaluates so that
// `resolvedInputFull` returns the formatted input on the very first
// render of the expanded section — avoiding a visible flash/pop-in
// for lazy-loaded history tool calls where `.onAppear` fires too late.
if newValue, cachedInputFull == nil {
if let dict = toolCall.inputRawDict {
cachedInputFull = ToolCallData.formatAllToolInput(dict)
} else if !toolCall.inputFull.isEmpty {
cachedInputFull = toolCall.inputFull
}
}
}
.onChange(of: toolCall.inputFull) { _ in
// Invalidate the cached formatted input so the next render picks up
// the fresh (rehydrated) value instead of the stale truncated one.
Expand Down
13 changes: 13 additions & 0 deletions clients/shared/Features/Chat/ToolCallChip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ public struct ToolCallChip: View {
? VColor.error.opacity(0.3)
: VColor.surfaceBorder.opacity(0.5), lineWidth: 0.5)
)
.onChange(of: isExpanded) { newValue in
// Populate the cache *before* the expanded body evaluates so that
// `resolvedInputFull` returns the formatted input on the very first
// render of the expanded section — avoiding a visible flash/pop-in
// for lazy-loaded history tool calls where `.onAppear` fires too late.
if newValue, cachedInputFull == nil {
if let dict = toolCall.inputRawDict {
cachedInputFull = ToolCallData.formatAllToolInput(dict)
} else if !toolCall.inputFull.isEmpty {
cachedInputFull = toolCall.inputFull
}
}
}
.onChange(of: toolCall.inputFull) { _ in
// Invalidate the cached formatted input so the next render picks up
// the fresh (rehydrated) value instead of the stale truncated one.
Expand Down
Loading