Lucas-Israel / trybnb

0 stars 0 forks source link

viewmodel parameter #5

Closed FilipeLipan closed 1 month ago

FilipeLipan commented 1 month ago

https://github.com/Lucas-Israel/trybnb/blob/b8ec8285ecb51c3396b7840be2fa4a55662e3f9d/app/src/main/java/com/betrybe/trybnb/ui/adapters/BookingAdapter.kt#L18

You should never send a view model as a parameter; this is very bad practice

List can cause issues Always try to use ImmutableList in a RecyclerView adapter; they avoid a lot of issues.

Lucas-Israel commented 1 month ago

removed viewModel as a parameter: https://github.com/Lucas-Israel/trybnb/commit/f0f3e8d47d1a3a70950c741583c8df0cba7014b3

Lucas-Israel commented 1 month ago

changed from mutable list to immutable list when "injecting" the bookings: https://github.com/Lucas-Israel/trybnb/commit/da17f920daee36ca72fd2e51b18497503033f1e1