Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use distinctUntilChanged() in DAO #68

Open
PatilShreyas opened this issue Jun 14, 2021 · 0 comments
Open

Use distinctUntilChanged() in DAO #68

PatilShreyas opened this issue Jun 14, 2021 · 0 comments

Comments

@PatilShreyas
Copy link
Owner

PatilShreyas commented Jun 14, 2021

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

@PatilShreyas PatilShreyas changed the title Use distinctUntilChanged() in dao?. Use distinctUntilChanged() in DAO Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant