Fatal error: No ObservableObject of type StoreObservableObject... #2269
Replies: 5 comments
-
The I would also like to draw your attention to the "Important" note in the docs of
This means for this code: case let .loading(state):
LoadingView(state: state, orientation: .vertical)
…
case let .error(text):
ErrorView(text: text) …the views will only be rendered a single type when the case switches to |
Beta Was this translation helpful? Give feedback.
-
@mbrandonw Thank you for your response. Here is a demo project with two cases Also when reproducing, found something. When you remove the action from:
crash solves but a warning appears:
|
Beta Was this translation helpful? Give feedback.
-
Interesting - it also works without any crash when using an
|
Beta Was this translation helpful? Give feedback.
-
Hi @artemkrachulov, thanks for the repro and now I see what is going on. The problem is that your types do not match up. You are "switching" on a store that has And the reason it works with the "old" version of your demo is because you are not scoping the main store's actions down to It would of course be best if we could catch these things at compile time instead of runtime, but often that is not possible in SwiftUI. Even vanilla SwiftUI has similar problems, such as no guarantees that the value you use in Since this is not an issue in the library I am going to convert it to a discussion. |
Beta Was this translation helpful? Give feedback.
-
@mbrandonw Oh yes, when I started using the switch content action, everything fell into place.
Now It has followed look:
Thx |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
After upgrading TCA to 0.55.0 I found a very useful SwichStore update which helps me to remove useless reducers from the SwitchStore. Here is the current code which works with a warning:
And updated code:
Only this code triggers an error after run:
What can it be? Any way to solve it?
Checklist
main
branch of this package.Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
The Composable Architecture version information
0.55.0
Destination operating system
iOS 16.5.1
Xcode version information
Version 14.3.1 (14E300c)
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions