talk-android icon indicating copy to clipboard operation
talk-android copied to clipboard

ContactsViewModel shouldn't retrieve all users in the constructor

Open rapterjet2004 opened this issue 3 weeks ago • 0 comments

The ContactsViewModel is currently retrieving users on object creation

init {
      getContactsFromSearchParams()
}

which isn't inherently bad, but when used with our dependency injection setup, each @Inject creates a new instance of the class, which means that unnecessary network calls are made with entering activities that may rely on the functions exposed through the view model, but are not immediately requiring the entire contacts list of the user.

rapterjet2004 avatar Dec 12 '25 15:12 rapterjet2004