Comments (1)
@nmalevich We recently added this runtime warning because nested observes can have unintended consequences. In this case, a viewDidLoad
is evaluated in the same stack as the presenting view controller's observe
, which means all child state evaluated in the child controller's observe
will be observed by the parent.
To work around the problem, you can move observe
into viewWillAppear
instead, and manage the lifetime of the observation token, or you can dispatch the observation a tick in viewDidLoad
:
DispatchQueue.main.async {
observe { [weak self] in
…
}
}
We're still deciding if this warning is too heavy-handed, but we don't consider it a bug at the moment. Because of this I'm going to convert this to a discussion.
from swift-composable-architecture.
Related Issues (20)
- Non-main thread warning when calling using .refreshable from child @ViewBuilder property HOT 1
- Focus state doesn't work as described in the Building SyncUps Tutorial
- UUID creation not working as described in the SyncUps Tutorial HOT 2
- FileStorage persistence sometimes doesn't save data to disk. HOT 1
- Some texts not appearing correctly: body-8lumc
- SharedState with UserDefaults(suiteName:) not working properly HOT 3
- NSLock Memory leaks HOT 1
- CRASH: Could not cast value of type 'Observation.ObservationRegistrar' to 'Perception._PerceptionRegistrar' HOT 2
- SyncUps Tutorial: Removing attendee test does not pass HOT 1
- isPresented dependency: Incorrectly set to 'true' in tests. HOT 7
- Using both Sharing Data and backward-compatible NavigationLink seems to create some strange behaviors. HOT 1
- Incorrect Confirmation Dialog Presentation on iPad HOT 1
- Ios 17 TextField Binding Issue HOT 1
- Stack overflow crash on physical device HOT 1
- Over-Observation with enum based State HOT 1
- Over-Observation with @Shared-state HOT 1
- @Shared publisher extra emissions only on macOS previews HOT 1
- @Shared(.appStorage) updates are triggered whenever any UserDefaults key changes, not just a specific key HOT 2
- @Shared can trigger a view update from a thread other than the main thread, which sometimes causes crash HOT 1
- NavigationStack path doesn't retain correct detail view when reordering a list with NavigationLinks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-composable-architecture.