Skip to content

View Not Updating on resetCounters Despite _printChanges Showing Correct State #3612

Answered by pyrtsa
topkim993 asked this question in Q&A
Discussion options

You must be logged in to vote

This is starting to look to me like a soundness issue with @ObservableState. It has little or nothing to do with IdentifiedArray and everything with observation macros silently turning struct State into a reference-semantic type! 🤯

You get a similarly broken experience with this simpler wrapper around CounterListFeature (and …View):

@Reducer
struct SingleCounterFeature {
    @ObservableState
    struct State: Equatable {
        let `default` = CounterFeature.State(id: UUID(), count: 0)
        var counter: CounterFeature.State?
    }

    enum Action {
        case reset
        case counter(CounterFeature.Action)
    }

    var body: some ReducerOf<Self> {
        Reduce { state, action in

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@topkim993
Comment options

@pyrtsa
Comment options

Answer selected by topkim993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants