Investigate Live Activity Session Load
Nucleic-Session: 044A9B93-AB31-4B6B-9A27-3631261269B1 Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -31,62 +31,66 @@ struct SessionDetailView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TranscriptList(events: store.openEvents,
|
// The detail's height comes from the enclosing GeometryReader — a value fixed by the parent
|
||||||
scrollToBottomRequest: scrollToBottomRequest,
|
// (the navigation content area), never by anything inside it. The attention cards (approval /
|
||||||
isScrolledToBottom: $isScrolledToBottom)
|
// question) cap themselves to this so their buttons stay on-screen. Sourcing it from a
|
||||||
// The chat bar floats over the scrolling content on Liquid Glass instead of sitting
|
// GeometryReader — rather than measuring the transcript, whose height the cards' own bottom
|
||||||
// in a boxed strip below it, so the transcript runs the full height of the screen.
|
// `safeAreaInset` resizes — makes the measurement categorically independent of the card, so
|
||||||
.safeAreaInset(edge: .bottom) { actionArea }
|
// the card can't feed its height back into the value it's sized from. That feedback was an
|
||||||
// Measure the whole detail's height — the screen area the action card must fit within —
|
// unresolved layout cycle that pinned the main thread at 100% CPU during the push transition;
|
||||||
// and hand it to the card so it can cap itself and keep Allow/Deny (or Submit) on-screen.
|
// it showed up intermittently because a feedback loop only diverges for some content/card-
|
||||||
// Measured *after* the safeAreaInset on purpose: this must be the fixed container height,
|
// height combinations. It bit only the attention path (a card consumes this value; the plain
|
||||||
// not the transcript's inset-reduced height. The attention cards (approval / question)
|
// composer doesn't), which is why a "Working" tap opened fine and an "attention" tap hung.
|
||||||
// size themselves off `availableHeight` via `.frame(maxHeight:)`, so measuring it from the
|
GeometryReader { proxy in
|
||||||
// inset-reduced region fed the card's own height back into the value it was sized from — a
|
TranscriptList(events: store.openEvents,
|
||||||
// layout cycle SwiftUI never resolved, pinning the main thread at 100% CPU during the push
|
scrollToBottomRequest: scrollToBottomRequest,
|
||||||
// transition. It bit only the attention path (a card consumes this value; the plain
|
isScrolledToBottom: $isScrolledToBottom)
|
||||||
// composer doesn't), which is why a "Working" tap opened fine and an "attention" tap hung.
|
// The chat bar floats over the scrolling content on Liquid Glass instead of sitting
|
||||||
.background {
|
// in a boxed strip below it, so the transcript runs the full height of the screen.
|
||||||
GeometryReader { proxy in
|
.safeAreaInset(edge: .bottom) { actionArea }
|
||||||
Color.clear.preference(key: AvailableHeightKey.self, value: proxy.size.height)
|
.navigationTitle(summary?.title ?? "Session")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
// With a session open the floating chat bar owns the bottom edge, so the compact
|
||||||
|
// shell's `NucleicTabBar` slides away while this detail is pushed — driven by the
|
||||||
|
// `open`/`closeOpen` below, which set `store.compactDetailPresented` (so the bar hides
|
||||||
|
// from any entry point, not just the Sessions list), not a per-navigation tab-bar
|
||||||
|
// toolbar hide (which restored the system bar late and made the "+" jump). A no-op in
|
||||||
|
// the iPad split, which has no tab bar.
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) { sessionMenu }
|
||||||
|
}
|
||||||
|
.sheet(isPresented: $showDiff) { diffSheet }
|
||||||
|
.alert("Rename chat", isPresented: $showRename) {
|
||||||
|
TextField("Title", text: $renameDraft)
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
Button("Rename") { store.renameSession(sessionID, to: renameDraft) }
|
||||||
|
}
|
||||||
|
.confirmationDialog("Integrate this branch", isPresented: $showIntegrate, titleVisibility: .visible) {
|
||||||
|
Button("Merge") { store.integrate(sessionID, .merge) }
|
||||||
|
Button("Squash & merge") { store.integrate(sessionID, .squash) }
|
||||||
|
Button("Rebase") { store.integrate(sessionID, .rebase) }
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
}
|
||||||
|
.confirmationDialog(
|
||||||
|
"Discard this session's branch and worktree? Unmerged work is lost.",
|
||||||
|
isPresented: $showDiscard, titleVisibility: .visible
|
||||||
|
) {
|
||||||
|
Button("Discard", role: .destructive) { store.discard(sessionID) }
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
}
|
||||||
|
.onAppear { store.open(sessionID) }
|
||||||
|
// Pass our own id so an iPad split-view A→B switch (which may mount B before A
|
||||||
|
// disappears) unsubscribes A without tearing down B's just-opened state.
|
||||||
|
.onDisappear { store.closeOpen(sessionID) }
|
||||||
|
.background { interruptShortcut }
|
||||||
|
// Publish the parent-determined height to the cards. `initial: true` seeds it on the
|
||||||
|
// first layout; it refreshes if the container resizes (rotation, keyboard, iPad split
|
||||||
|
// resize). Because `proxy.size.height` never depends on the card, updating this can't
|
||||||
|
// re-drive the measurement — no cycle.
|
||||||
|
.onChange(of: proxy.size.height, initial: true) { _, height in
|
||||||
|
availableHeight = height
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.onPreferenceChange(AvailableHeightKey.self) { availableHeight = $0 }
|
|
||||||
.navigationTitle(summary?.title ?? "Session")
|
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
|
||||||
// With a session open the floating chat bar owns the bottom edge, so the compact
|
|
||||||
// shell's `NucleicTabBar` slides away while this detail is pushed — driven by the
|
|
||||||
// `open`/`closeOpen` below, which set `store.compactDetailPresented` (so the bar hides
|
|
||||||
// from any entry point, not just the Sessions list), not a per-navigation tab-bar
|
|
||||||
// toolbar hide (which restored the system bar late and made the "+" jump). A no-op in
|
|
||||||
// the iPad split, which has no tab bar.
|
|
||||||
.toolbar {
|
|
||||||
ToolbarItem(placement: .topBarTrailing) { sessionMenu }
|
|
||||||
}
|
|
||||||
.sheet(isPresented: $showDiff) { diffSheet }
|
|
||||||
.alert("Rename chat", isPresented: $showRename) {
|
|
||||||
TextField("Title", text: $renameDraft)
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
Button("Rename") { store.renameSession(sessionID, to: renameDraft) }
|
|
||||||
}
|
}
|
||||||
.confirmationDialog("Integrate this branch", isPresented: $showIntegrate, titleVisibility: .visible) {
|
|
||||||
Button("Merge") { store.integrate(sessionID, .merge) }
|
|
||||||
Button("Squash & merge") { store.integrate(sessionID, .squash) }
|
|
||||||
Button("Rebase") { store.integrate(sessionID, .rebase) }
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
}
|
|
||||||
.confirmationDialog(
|
|
||||||
"Discard this session's branch and worktree? Unmerged work is lost.",
|
|
||||||
isPresented: $showDiscard, titleVisibility: .visible
|
|
||||||
) {
|
|
||||||
Button("Discard", role: .destructive) { store.discard(sessionID) }
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
}
|
|
||||||
.onAppear { store.open(sessionID) }
|
|
||||||
// Pass our own id so an iPad split-view A→B switch (which may mount B before A
|
|
||||||
// disappears) unsubscribes A without tearing down B's just-opened state.
|
|
||||||
.onDisappear { store.closeOpen(sessionID) }
|
|
||||||
.background { interruptShortcut }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ⌘. interrupts a running session (the Mac's "stop" convention) — the action is otherwise
|
/// ⌘. interrupts a running session (the Mac's "stop" convention) — the action is otherwise
|
||||||
|
|||||||
Reference in New Issue
Block a user