Open ilmotta opened 4 months ago
I checked the Desktop app and it does something different. It actually allows the user to close a spectated community by right clicking and choosing the option "Close Community". The endpoint called is wakuext_leaveCommunity
.
We should do the same and not go for the more complicated garbage collection approach mentioned in the issue description. Ideally, this issue should be solved alongside https://github.com/status-im/status-mobile/issues/20762, otherwise the user will have to frequently close spectated communities because we incorrectly spectate them automatically whenever Discover Communities is opened.
In the desktop app, the user doesn't see any confirmation pop-up when leaving a spectated community. We can add an option to the community drawer saying "Close Community" when long pressing on a spectated community.
To anyone working on this issue, please confirm with designers this is the expected behavior before proceeding with implementation.
Problem
When a user opens a community but never joins it, the community stays in the
spectated
state and accessible in theOpened
tab in the home screen, forever, even after logout. Each spectated community will eat considerable resources, much like a community the user has joined. This is a form of resource leak.The main performance cost here for the mobile app comes from the overhead of keeping the state in sync as signals arrive for a community (esp. a large one), given that we globally process signals independently of the current screen the user is at.
Original discussion in https://github.com/status-im/status-mobile/pull/20508#issuecomment-2188587426.
Implementation
Based on a private discussion with @cammellos:
This automatic approach should be preferred because it could be confusing to users to leave/close/unspectate communities manually. Additionally, it wouldn't be obvious to users why manually closing spectated communities is necessary.
Scope
Although the problem exists in theory, it shouldn't affect users at the moment because creating communities is disabled on status-desktop and creation is also not available on mobile, therefore we should postpone work on this issue.