Skip to content

Conversation

@dogi
Copy link
Member

@dogi dogi commented Nov 10, 2025

Refactored BaseDashboardFragment to use DashboardViewModel for fetching the "My Library" data.

  • Injected DashboardViewModel into BaseDashboardFragment using Hilt.
  • Moved the Realm query for library items from the fragment to a suspend function in the ViewModel.
  • The fragment now calls the ViewModel from a lifecycleScope coroutine to load the data asynchronously.
  • This change moves a database query off the main thread, improving performance and adhering to a better architectural pattern by separating UI and data concerns.

https://jules.google.com/session/3990081894014682692

Refactored `BaseDashboardFragment` to use `DashboardViewModel` for fetching the "My Library" data.

- Injected `DashboardViewModel` into `BaseDashboardFragment` using Hilt.
- Moved the Realm query for library items from the fragment to a `suspend` function in the ViewModel.
- The fragment now calls the ViewModel from a `lifecycleScope` coroutine to load the data asynchronously.
- This change moves a database query off the main thread, improving performance and adhering to a better architectural pattern by separating UI and data concerns.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 66 to +71
suspend fun getUnreadNotificationsSize(userId: String?): Int {
return notificationRepository.getUnreadCount(userId)
}

suspend fun getMyLibraryItems(userId: String?): List<RealmMyLibrary> {
return libraryRepository.getLibraryListForUser(userId)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid narrowing "My Library" query

The new getMyLibraryItems delegates to LibraryRepository.getLibraryListForUser, which filters results to non‑private items that needToUpdate() and does not merge team resources. The previous fragment code called RealmMyLibrary.getMyLibraryByUserId, which returned all items the user owns or receives through team membership regardless of update status. As a result, the dashboard’s “My Library” section will now omit any up‑to‑date or team‑shared resources and show only those needing updates, changing the visible data set rather than just moving the query off the main thread.

Useful? React with 👍 / 👎.

@dogi dogi added the close? label Nov 10, 2025
@dogi dogi closed this Nov 10, 2025
@dogi dogi reopened this Nov 10, 2025
@dogi dogi removed the close? label Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants