Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist... #997

Merged
merged 60 commits into from
Sep 26, 2019

Conversation

Jikstra
Copy link
Contributor

@Jikstra Jikstra commented Sep 19, 2019

@Jikstra Jikstra changed the base branch from master to tweak_confirmation_dialog September 19, 2019 20:45
@Jikstra Jikstra changed the title Refactor/Reword Forward Message Dialog and implement async lazy loading chatlist [wip] Refactor/Reword Forward Message Dialog and implement async lazy loading chatlist Sep 20, 2019
@Jikstra Jikstra changed the title [wip] Refactor/Reword Forward Message Dialog and implement async lazy loading chatlist [wip] Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist Sep 24, 2019
@Jikstra Jikstra changed the title [wip] Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist Sep 24, 2019
@Jikstra Jikstra changed the title Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist Rework Forward Message Dialog, Chatlist and implement async lazy loading chatlist... Sep 24, 2019
// Don't update if a draft changes
if (msgId === 0) return
this.onChatListChanged()
this.onChatListItemChanged(chatId)
this.onMessageUpdate(chatId, msgId, 'DC_EVENT_MSGS_CHANGED')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicodh the reason why we call onChatListChanged and onChatListItemChanged is because onChatListChanged triggers a refetch of the chatlist, which would result in a resorting of the displayed chatlists. The useLazyChatListItems hook only tries to fetch chats in view after chatListIds changed, but doesn't force refetch them (this is needed for search, where only the sort/which ids are shown changes but we don't want to refetch all chats). And this is where onChatListItemChanged comes into play, because if called with chatId=0, it force refetches all chats in view. It probably makes sense to split this into two events, onChatListItemChanged onChatListForceUpdateInView or something like this.

@Simon-Laux
Copy link
Member

Compliance department says YOLO

@Simon-Laux Simon-Laux changed the base branch from tweak_confirmation_dialog to master September 26, 2019 15:16
@Simon-Laux Simon-Laux merged commit 2a5781d into master Sep 26, 2019
@Jikstra Jikstra deleted the fix_refaword_forwad_message branch January 1, 2020 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment