Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit df7e30a

Browse files
committed
Extract replayableActions as a stream
1 parent 834578e commit df7e30a

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

xcode/Subconscious/Shared/Components/Notebook/Notebook.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ struct NotebookView: View {
2828
)
2929
)
3030
@Environment (\.colorScheme) var colorScheme
31+
32+
private var replayableAppActions: AnyPublisher<NotebookAction, Never> {
33+
app.actions
34+
.compactMap(NotebookAction.from)
35+
.filter { action in
36+
action == .ready
37+
|| app.state.selectedAppTab == .notebook
38+
}
39+
.eraseToAnyPublisher()
40+
}
3141

3242
var body: some View {
3343
// Give each element in this ZStack an explicit z-index.
@@ -82,12 +92,7 @@ struct NotebookView: View {
8292
}
8393
/// Replay some app actions on notebook store
8494
.onReceive(
85-
app.actions
86-
.compactMap(NotebookAction.from)
87-
.filter { action in
88-
action == .ready
89-
|| app.state.selectedAppTab == .notebook
90-
},
95+
replayableAppActions,
9196
perform: store.send
9297
)
9398
/// Replay select notebook actions on app

0 commit comments

Comments
 (0)