Skip to content

Commit 7eec1ec

Browse files
committed
Refactor: Remove redundant ExecutionStateTrigger
The `ExecutionStateTrigger` struct and its associated `executionStateTrigger` computed property in `MainContentView` are no longer necessary. The toolbar execution state is now directly managed by observing the `currentTab?.isExecuting` and `currentTab?.executionTime` properties. This change simplifies the binding logic and removes redundant state management.
1 parent 228cc7a commit 7eec1ec

2 files changed

Lines changed: 3 additions & 20 deletions

File tree

TablePro/Views/Main/Extensions/MainContentView+Bindings.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,7 @@ extension MainContentView {
102102
)
103103
}
104104

105-
/// Trigger for toolbar execution state — combines `isExecuting` and `executionTime`
106-
/// from the current tab. Replaces two separate handlers that both updated `toolbarState`.
107-
var executionStateTrigger: ExecutionStateTrigger {
108-
ExecutionStateTrigger(
109-
isExecuting: currentTab?.isExecuting ?? false,
110-
executionTime: currentTab?.executionTime
111-
)
112-
}
105+
113106
}
114107

115108
// MARK: - Equatable Trigger Types
@@ -130,9 +123,4 @@ struct PendingChangeTrigger: Equatable {
130123
let hasStructureChanges: Bool
131124
}
132125

133-
/// Lightweight equatable value combining execution state properties
134-
/// for consolidated toolbar execution onChange observation.
135-
struct ExecutionStateTrigger: Equatable {
136-
let isExecuting: Bool
137-
let executionTime: TimeInterval?
138-
}
126+

TablePro/Views/MainContentView.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ struct MainContentView: View {
193193
.onChange(of: DatabaseManager.shared.currentSession?.status) { _, newStatus in
194194
handleSessionStatusChange(newStatus)
195195
}
196-
.onChange(of: executionStateTrigger) { _, newValue in
197-
toolbarState.isExecuting = newValue.isExecuting
198-
if let time = newValue.executionTime {
199-
toolbarState.lastQueryDuration = time
200-
}
201-
}
196+
202197
.onChange(of: selectedTables) { _, newTables in
203198
handleTableSelectionChange(from: previousSelectedTables, to: newTables)
204199
previousSelectedTables = newTables

0 commit comments

Comments
 (0)