-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix race condition in FileStorageKey #3479
Changes from all commits
63dcb00
27edfe0
6f6a0c7
787aaac
bc8ee05
5f2a979
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Unchanged files with check annotations Beta
/// | ||
/// See ``PersistenceReaderKey/appStorage(_:)-5jsie`` to create values of this type. | ||
public struct AppStorageKeyPathKey<Value: Sendable>: Sendable { | ||
private let keyPath: _SendableReferenceWritableKeyPath<UserDefaults, Value> | ||
Check warning on line 28 in Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift
|
||
private let store: UncheckedSendable<UserDefaults> | ||
public init(_ keyPath: _SendableReferenceWritableKeyPath<UserDefaults, Value>) { |
@propertyWrapper | ||
public struct Shared<Value: Sendable>: Sendable { | ||
private let reference: any Reference | ||
private let keyPath: _SendableAnyKeyPath | ||
Check warning on line 17 in Sources/ComposableArchitecture/SharedState/Shared.swift
|
||
init(reference: any Reference, keyPath: _SendableAnyKeyPath) { | ||
self.reference = reference |
/// | ||
/// Read <doc:Bindings> for more information. | ||
public struct BindingAction<Root>: CasePathable, Equatable, Sendable { | ||
public let keyPath: _SendablePartialKeyPath<Root> | ||
Check warning on line 147 in Sources/ComposableArchitecture/SwiftUI/Binding.swift
|
||
@usableFromInline | ||
let set: @Sendable (inout Root) -> Void |
} | ||
func testCopyMutation() async { | ||
XCTTODO( | ||
Check warning on line 22 in Tests/ComposableArchitectureTests/ObservableTests.swift
|
||
""" | ||
Ideally this test would pass but it does not because making a copy of a child state, mutating | ||
it, and assigning it does not change the identified array's IDs, and therefore the fast-path | ||
} | ||
func testReplace() async { | ||
XCTTODO("Ideally this would pass but we cannot detect this kind of mutation currently.") | ||
Check warning on line 66 in Tests/ComposableArchitectureTests/ObservableTests.swift
|
||
var state = ChildState(count: 42) | ||
let countDidChange = self.expectation(description: "count.didChange") | ||
} | ||
func testReset() async { | ||
XCTTODO("Ideally this would pass but we cannot detect this kind of mutation currently.") | ||
Check warning on line 83 in Tests/ComposableArchitectureTests/ObservableTests.swift
|
||
var state = ChildState(count: 42) | ||
let countDidChange = self.expectation(description: "count.didChange") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made to the file on disk will be ignored if there is an enqueued state change waiting to be saved.