Skip to content

Commit

Permalink
Revert back old code, but keep Task { @mainactor
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif committed Oct 25, 2024
1 parent e2a33d8 commit a7ba8ac
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Sources/AppState/Application/Types/State/Application+State.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension Application {
)
else {
defer {
Task { @MainActor in
let setValue = {
shared.cache.set(
value: Application.State(
type: .state,
Expand All @@ -44,6 +44,17 @@ extension Application {
forKey: scope.key
)
}
#if (!os(Linux) && !os(Windows))
if NSClassFromString("XCTest") == nil {
Task { @MainActor in
setValue()
}
} else {
setValue()
}
#else
setValue()
#endif
}
return _value
}
Expand Down

0 comments on commit a7ba8ac

Please sign in to comment.