Status-react: Add to contacts appears for a while when joining to public chat

Created on 22 Nov 2018  路  4Comments  路  Source: status-im/status-react

Description

Type: Bug

Summary: Add to contacts screen appears for less than a second when user joins public chat

Expected behavior

I do want clear screen transitions. When i join public chat there is nothing i want to add to contacts. This screen should not flash even for a milisecond.

Actual behavior

Add to contacts appears for a while when joining to public chat

Reproduction

  • Open Status
  • Create account
  • Join #status public chat
bug low-priority

All 4 comments

Again can reproduce in RC 0.10.1, nightly 04.03.2109
@yenda take a look when you have time, thanks!

I have a theory/take on this:

It happens because more often than not (maybe always) (not group-chat) in

(when (and (not group-chat)
                (models.contact/can-add-to-contacts? contact))
       [add-contact-bar chat-id])

becomes true because group-chat is nil and not because it is false

perhaps because when joining new public chat, upserting the chat and updating current-chat-id to the new chat in the app-db, happens after navigating to it, and not as we intended/assumed it to happen before.

I fixed it in my local wip PR for #7454 by subscribing to [:chats/current-chat-id] and adding another condition (= current-chat-id chat-id) in the and form above.

But, there might be better solutions, perhaps by changing the ordering of effects in definition/registration of navigate-to-chat or even start-public-chat. Unsure because re-frame docs on Effects says:

Order Of Effects?
There isn't one.

Probably should've made a separate PR for this particular issue, but, encountering it while working on #7454, whose issues were in a way overlapping with this, was bothersome. So fix for this according to reasoning proposed above, is included in #7454 which is now merged.

https://github.com/status-im/status-react/blob/be2b2a112eda82408fff4a6880732434bc32e858/src/status_im/ui/screens/chat/views.cljs#L263-L267

@churik is the issue still reproducible on current develop or nightly?

Yeah, it is not, so seems #7454 fixed it.
Thanks @bitsikka !

Was this page helpful?
0 / 5 - 0 ratings