Skip to content

Commit d2a9dbe

Browse files
Fix status bar not updating when workspace first opens
Fixes #1729 The tabBarTabIdSubject was a PassthroughSubject, which doesn't replay its current value to new subscribers. When the workspace opens, the initial tab selection is sent before the status bar view subscribes, so it never receives the initial value. Changed to CurrentValueSubject so late subscribers (like the status bar) immediately receive the current tab selection on subscription.
1 parent 118afcd commit d2a9dbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CodeEdit/Features/Editor/Models/EditorManager.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class EditorManager: ObservableObject {
2929
/// History of last-used editors.
3030
var activeEditorHistory: Deque<() -> Editor?> = []
3131

32-
/// notify listeners whenever tab selection changes on the active editor.
33-
var tabBarTabIdSubject = PassthroughSubject<Editor.Tab?, Never>()
32+
/// Notify listeners whenever tab selection changes on the active editor.
33+
/// Uses `CurrentValueSubject` so late subscribers (e.g. status bar) receive the current value immediately.
34+
var tabBarTabIdSubject = CurrentValueSubject<Editor.Tab?, Never>(nil)
3435
var cancellable: AnyCancellable?
3536

3637
// This caching mechanism is a temporary solution and is not optimized

0 commit comments

Comments
 (0)