Skip to content

QueryPublisher unsubscribes after one event #86

Open
@Feuerwerk

Description

@Feuerwerk

Is there an existing issue?

Build info

  • ObjectBox version: 4.0.0

Steps to reproduce

let query: Query<Person> = ......
query.publisher
                    .replaceError(with: [])
                    /*.assign(to: \.persons, on: viewModel)*/
                    .sink(receiveValue: { persons in
                        viewModel.persons = persons
                    })
                    .store(in: &cancellables)

Expected behavior

I expected that viewModel.persons will update continuously when I add / change a record that will match my query.

Actual behavior

After the initial query result is consumed by the Subscriber, QueryPublisher will unsubscribe because various Subscriber implementations like sink(), assign(to:) or onReceive() of a SwiftUI view will return Subscriber.Demand.none which causes QueryPublisher to signal completion to the Subscriber and shut down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions