Skip to content

Use distinctUntilChanged() in DAO #68

@PatilShreyas

Description

@PatilShreyas

Should we not use distinctUntilChanged() in dao?.

      @Query("SELECT * FROM ${Post.TABLE_NAME} WHERE ID = :postId")
      fun getPostById(postId: Int): Flow<Post>

      fun getPostByIdUntilChanged(id: Int) = getPostById(id).distinctUntilChanged()

cause if we update a unrelated row the query also emits data with the same result again. https://medium.com/androiddevelopers/room-flow-273acffe5b57

Originally posted by @raghunandankavi2010 in #61

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions