Skip to content

Commit 89ec245

Browse files
committed
Fix for release build failure
1 parent e3175b9 commit 89ec245

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

Sources/Atoms/Core/StoreContext.swift

+23-25
Original file line numberDiff line numberDiff line change
@@ -306,33 +306,29 @@ private extension StoreContext {
306306
updatedScopes[currentScope.key] = currentScope
307307
}
308308

309-
// Performs update of the given atom with the dependency's context.
310-
func performUpdate(for key: AtomKey, cache: some AtomCacheProtocol, dependency: some Atom) {
311-
dependency.producer.performUpdate {
312-
// Dependents must be updated with the scope at which they were initialised.
313-
let localContext = StoreContext(
314-
store: store,
315-
rootScope: rootScope,
316-
currentScope: cache.initializedScope
317-
)
318-
319-
let didUpdate = localContext.transitiveUpdate(for: key, cache: cache)
320-
321-
guard didUpdate else {
322-
// Record the atom to avoid downstream from being update.
323-
skippedDependencies.insert(key)
324-
return
325-
}
309+
func transitiveUpdate(for key: AtomKey, cache: some AtomCacheProtocol) {
310+
// Dependents must be updated with the scope at which they were initialised.
311+
let localContext = StoreContext(
312+
store: store,
313+
rootScope: rootScope,
314+
currentScope: cache.initializedScope
315+
)
326316

327-
if let scope = cache.initializedScope {
328-
updatedScopes[scope.key] = scope
329-
}
317+
let didUpdate = localContext.transitiveUpdate(for: key, cache: cache)
318+
319+
guard didUpdate else {
320+
// Record the atom to avoid downstream from being update.
321+
skippedDependencies.insert(key)
322+
return
323+
}
324+
325+
if let scope = cache.initializedScope {
326+
updatedScopes[scope.key] = scope
330327
}
331328
}
332329

333-
// Performs update of the given subscription with the dependency's context.
334-
func performUpdate(subscription: Subscription, dependency: some Atom) {
335-
dependency.producer.performUpdate(subscription.update)
330+
func performUpdate(dependency: some Atom, body: @MainActor () -> Void) {
331+
dependency.producer.performUpdate(body)
336332
}
337333

338334
func validEdge(_ edge: Edge) -> Edge? {
@@ -365,7 +361,9 @@ private extension StoreContext {
365361
let dependencyCache = store.state.caches[edge.from]
366362

367363
if let cache, let dependencyCache {
368-
performUpdate(for: key, cache: cache, dependency: dependencyCache.atom)
364+
performUpdate(dependency: dependencyCache.atom) {
365+
transitiveUpdate(for: key, cache: cache)
366+
}
369367
}
370368

371369
case .subscriber(let key):
@@ -377,7 +375,7 @@ private extension StoreContext {
377375
let dependencyCache = store.state.caches[edge.from]
378376

379377
if let subscription, let dependencyCache {
380-
performUpdate(subscription: subscription, dependency: dependencyCache.atom)
378+
performUpdate(dependency: dependencyCache.atom, body: subscription.update)
381379
}
382380
}
383381
}

scripts/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ while [[ $# -gt 0 ]]; do
4444
esac
4545
done
4646

47-
eval xcodebuild clean test "${options[@]-}" "${args[@]-}"
47+
eval xcodebuild clean test -configuration Release ENABLE_TESTABILITY=YES "${options[@]-}" "${args[@]-}"

0 commit comments

Comments
 (0)