Skip to content
Discussion options

You must be logged in to vote

Use the nullable single-row stream for a row that can disappear.

watchSingle() is documented as asserting that exactly one row is emitted each time the query runs, and the implementation is watch().transform(singleElements()). So the error after delete is the intended invariant failure: the query is now returning zero rows while something is still listening. watchSingleOrNull() is the variant documented for empty result sets; it emits null instead of treating the missing row as an error.

For a deletable list item provider, I would make the row-level provider return Stream<T?> from watchSingleOrNull() and treat null as "this row has been deleted" in the UI/state layer. autoDispose is still…

Replies: 1 comment 2 replies

Comment options

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

@nicholaschiang
Comment options

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