pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.22k stars 1.42k forks source link

Fix: Crash when writing to user defaults in background thread #3285

Closed larryonoff closed 4 weeks ago

larryonoff commented 4 weeks ago

Potential fix for the issue https://github.com/pointfreeco/swift-composable-architecture/issues/3247

stephencelis commented 4 weeks ago

@larryonoff Can you add a test that would have failed/crashed before the fix?

larryonoff commented 4 weeks ago

@larryonoff Can you add a test that would have failed/crashed before the fix?

@stephencelis Just updated the tests, failed - before the fix, success - now. Previously, the tests only covered updates from publisher (that handled in the main thread), leaving out perception updates.

larryonoff commented 4 weeks ago

@mbrandonw BTW I assume that test part that checks publisher may be deleted. SwiftUI doesn't subscribe to publisher, it uses perception.