Skip to content
Discussion options

You must be logged in to vote

Hey @wltrup!
The problem comes from here:

struct State: Equatable {
    var itemsA = ItemsArray(uniqueElements: Mocks.items)
    var items: ItemsListScene.State {
        get { .init(items: itemsA) }
        set { /* empty - the items tab does not change the array of items */ }
    }
}

The set shouldn't be noop: the searchText value you just set in the child feature is discarded, and you return a brand new ItemsListScene.State with this field empty for the next round. It means that the search field is empty, so SwiftUI deletes the character you just entered and you get the impression that the field is stuck.
When deriving states with internal properties (like searchText), you need to make…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@wltrup
Comment options

@tgrapperon
Comment options

@wltrup
Comment options

Answer selected by wltrup
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