Skip to content

Commit 744092c

Browse files
committed
refactor: 중복 구독 막기
1 parent b448d4d commit 744092c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Application/DevLogPresentation/Sources/Settings/SettingsFeature.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import Foundation
1313

1414
@Reducer
1515
struct SettingsFeature {
16+
private enum CancelID: Hashable {
17+
case networkConnectivity
18+
case systemTheme
19+
}
20+
1621
@ObservableState
1722
struct State: Equatable {
1823
@Presents var alert: AlertState<Action.Alert>?
@@ -247,6 +252,7 @@ private extension SettingsFeature {
247252
.receive(on: DispatchQueue.main)
248253
.map(Action.networkStatusChanged)
249254
}
255+
.cancellable(id: CancelID.networkConnectivity, cancelInFlight: true)
250256
}
251257

252258
func monitorSystemThemeEffect() -> Effect<Action> {
@@ -256,6 +262,7 @@ private extension SettingsFeature {
256262
.receive(on: DispatchQueue.main)
257263
.map { .binding(.set(\.theme, $0)) }
258264
}
265+
.cancellable(id: CancelID.systemTheme, cancelInFlight: true)
259266
}
260267

261268
func updateSystemThemeEffect(_ theme: SystemTheme) -> Effect<Action> {

0 commit comments

Comments
 (0)