diff --git a/Sources/VDStore/Store.swift b/Sources/VDStore/Store.swift index d7ff99f..9159050 100644 --- a/Sources/VDStore/Store.swift +++ b/Sources/VDStore/Store.swift @@ -326,7 +326,7 @@ public struct Store: Sendable { try await StoreDIValues.$current.withValue(diModifier, operation: operation) } - func forceUpdateIfNeeded() { + func forceUpdate() { box.forceUpdate() } } @@ -381,8 +381,3 @@ private extension Store { DIPublisher(base: publisher, modifier: diModifier).eraseToAnyPublisher() } } - -extension Store: Identifiable where State: Identifiable { - - public var id: State.ID { state.id } -} diff --git a/Sources/VDStore/StoreExtensions/WithAnimaiton.swift b/Sources/VDStore/StoreExtensions/WithAnimaiton.swift index 91755b2..2d7b6fe 100644 --- a/Sources/VDStore/StoreExtensions/WithAnimaiton.swift +++ b/Sources/VDStore/StoreExtensions/WithAnimaiton.swift @@ -7,7 +7,7 @@ public extension Store { func withAnimation(_ animation: Animation? = .default, _ operation: @MainActor () throws -> T) rethrows -> T { try SwiftUI.withAnimation(animation) { let result = try update(operation) - forceUpdateIfNeeded() + forceUpdate() return result } } diff --git a/Sources/VDStore/Utils/StoreBox.swift b/Sources/VDStore/Utils/StoreBox.swift index 3e7b60f..18381b5 100644 --- a/Sources/VDStore/Utils/StoreBox.swift +++ b/Sources/VDStore/Utils/StoreBox.swift @@ -42,7 +42,7 @@ struct StoreBox: Publisher, Sendable { func startUpdate() { root.startUpdate() } func endUpdate() { root.endUpdate() } - func forceUpdate() { root.forceUpdateIfNeeded() } + func forceUpdate() { root.forceUpdate() } func receive(subscriber: S) where S: Subscriber, Never == S.Failure, Output == S.Input { valuePublisher.receive(subscriber: subscriber) @@ -54,7 +54,7 @@ private protocol StoreRootBoxType: Sendable { var willSetPublisher: AnyPublisher { get } func startUpdate() func endUpdate() - func forceUpdateIfNeeded() + func forceUpdate() } private final class StoreRootBox: StoreRootBoxType, Publisher, @unchecked Sendable { @@ -131,7 +131,7 @@ private final class StoreRootBox: StoreRootBoxType, Publisher, @unchecked } } - func forceUpdateIfNeeded() { + func forceUpdate() { guard updatesCounter > 0 || asyncUpdatesCounter > 0 else { return } sendDidSet() sendWillSet()