Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Sources/Sharing/SharedKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,15 @@ extension Shared {
/// - Parameter key: A shared key associated with the shared reference. It is responsible for
/// loading and saving the shared reference's value from some external source.
public func load(_ key: some SharedKey<Value>) async throws {
await MainActor.run {
@Dependency(PersistentReferences.self) var persistentReferences
SharedPublisherLocals.$isLoading.withValue(true) {
projectedValue = Shared(
reference: persistentReferences.value(
forKey: key,
default: wrappedValue,
skipInitialLoad: true
)
@Dependency(PersistentReferences.self) var persistentReferences
SharedPublisherLocals.$isLoading.withValue(true) {
projectedValue = Shared(
reference: persistentReferences.value(
forKey: key,
default: wrappedValue,
skipInitialLoad: true
)
}
)
}
try await load()
}
Expand Down
18 changes: 8 additions & 10 deletions Sources/Sharing/SharedReaderKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,15 @@ extension SharedReader {
/// - Parameter key: A shared key associated with the shared reference. It is responsible for
/// loading the shared reference's value from some external source.
public func load(_ key: some SharedReaderKey<Value>) async throws {
await MainActor.run {
@Dependency(PersistentReferences.self) var persistentReferences
SharedPublisherLocals.$isLoading.withValue(true) {
projectedValue = SharedReader(
reference: persistentReferences.value(
forKey: key,
default: wrappedValue,
skipInitialLoad: true
)
@Dependency(PersistentReferences.self) var persistentReferences
SharedPublisherLocals.$isLoading.withValue(true) {
projectedValue = SharedReader(
reference: persistentReferences.value(
forKey: key,
default: wrappedValue,
skipInitialLoad: true
)
}
)
}
try await load()
}
Expand Down