status-mobile icon indicating copy to clipboard operation
status-mobile copied to clipboard

Communities are being spectated even if the user never opened them

Open ilmotta opened this issue 1 year ago • 4 comments

Bug Report

Problem

The list of "Opened" (spectated) communities is changed even if the user never opened them. Every spectated community adds overhead and has to be kept in sync, thus potentially affecting the user experience. The problem is exacerbated by the fact that the user can't close opened communities, so they will forever stay there (see issue https://github.com/status-im/status-mobile/issues/20594).

To start with, I think we should focus on removing spectating from a reaction to a status-go signal. We should spectate a community only when we open a page of a community, not in response to any not-joined community in status-go.

-- Related to https://github.com/status-im/status-mobile/issues/19108

Expected behavior

Only when a user opens a community (sees the community overview screen) we should spectate. This commit 94453634678799a40f8a9979fa0070d0ebeef8a3 in theory fixed this problem, but something else still needs to be fixed.

Actual behavior

The Opened communities tab contains communities the user never opened.

Reproduction

  1. Create an account without communities to facilitate testing.
  2. Check the Communities Opened tab has no communities.
  3. Open the Discover communities screen by pressing on the banner and wait there until some communities are loaded. Don't open any of them.
  4. Close and go to the Opened tab, you should see the same communities from the Discover screen in the Opened tab, even though you never opened them.

Additional Information

  • Status version: nightly, commit 940edc2e53bf1e3a4e671c2dac7ae1cb329e348d from 2024-07-15
  • Operating System: Android, iOS

ilmotta avatar Jul 15 '24 22:07 ilmotta

@flexsurfer FYI: This issue was created some time ago and I remember you mentioned this problem recently.

ilmotta avatar Aug 20 '24 09:08 ilmotta

i would summon @churik and @cammellos they have more insights into why this happens

flexsurfer avatar Aug 20 '24 09:08 flexsurfer

The only context that I can give on current behavior, that it was even worse - before we tried to fetch messages for all communities when the "Discover"was opened. Now we start fetching messages / info only when community page was opened, that has been done here But I'm not quite sure about logic behind moving from Discover > Open, and based on my own expectations I can say that I'd expect to see in Opened tab only communities for that you already has been opened community page at least once.

churik avatar Aug 20 '24 09:08 churik

The only context that I can give on current behavior, that it was even worse - before we tried to fetch messages for all communities when the "Discover"was opened. Now we start fetching messages / info only when community page was opened, that has been done here But I'm not quite sure about logic behind moving from Discover > Open, and based on my own expectations I can say that I'd expect to see in Opened tab only communities for that you already has been opened community page at least once.

@churik, at the time of creation of this issue in develop we were certainly spectating all communities once they are visible in the Discover screen (thus without opening them from the Discover screen), hence why I opened this issue. The bug probably persists because I created the issue only ~1 month ago and that PR was merged ~2 months ago.

ilmotta avatar Aug 20 '24 14:08 ilmotta

At the moment, it seems like we're displaying any communities that are not considered joined or pending as an opened community here: https://github.com/status-im/status-mobile/blob/9862abb7ebaac387652b9f3ff263b96198a3679f/src/status_im/subs/communities.cljs#L190-L197

And I'm thinking we could only treat spectated communities as opened communities, so the logic would become something like this:

(defn- group-communities-by-status
  [requests
   {:keys [id]
    :as   community}]
  (cond
    (:joined community)         :joined
    (boolean (get requests id)) :pending
    (:spectated community)      :opened
    :else                       :other))


I wonder what the intended behaviour would be, should a community that has been joined also appear in the opened tab? cc @xAlisher @ilmotta

seanstrom avatar Nov 01 '24 00:11 seanstrom

Good question @seanstrom. I'm not sure either.

My inclination is to not overlap communities between tabs Joined/Pending/Opened, that is, a community should be either in Joined, Pending, or Opened, but never in Joined and Opened simultaneously. This way, each tab displays a unique and maybe more useful view of the communities.

ilmotta avatar Nov 01 '24 00:11 ilmotta

Okay I've pushed a PR to only show spectated communities in the "Opened" tab here: https://github.com/status-im/status-mobile/pull/21548

seanstrom avatar Nov 01 '24 18:11 seanstrom