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

feat: re-fetch conversations on opening search-ui [FS-1689] #15030

Merged
merged 16 commits into from May 9, 2023

Conversation

V-Gira
Copy link
Contributor

@V-Gira V-Gira commented Apr 17, 2023

Sub-taskFS-1689 [web] Retry fetching missing conversation metadata when the Search UI is opened

Feature

load missed conversations on opening the search ui

Step by step:

  • User A creates a conversation with user B while user B's client is offline
  • User A's backend becomes offline
  • User B connects to Wire and loadConversations() returns the new conversation as failed
  • The failed conversation is saved in user A's conversation state as a missing conversation
  • User A's backend comes back online
  • When user B clicks on the Contact tab, we refetch the missing conversations, and the new conversation appears in the conversation list
    Peek 2023-04-24 15-43

@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #15030 (d68f948) into dev (eda65f8) will decrease coverage by 0.16%.
The diff coverage is 62.50%.

@@            Coverage Diff             @@
##              dev   #15030      +/-   ##
==========================================
- Coverage   43.31%   43.16%   -0.16%     
==========================================
  Files         643      644       +1     
  Lines       21551    21633      +82     
  Branches     4933     4955      +22     
==========================================
+ Hits         9335     9337       +2     
- Misses      11029    11104      +75     
- Partials     1187     1192       +5     

@V-Gira V-Gira marked this pull request as ready for review April 24, 2023 16:55
@V-Gira V-Gira requested review from a team and otto-the-bot as code owners April 24, 2023 16:55
Comment on lines 95 to 98
const updateConversations = async () => {
await conversationRepository.loadMissingConversations();
};
void updateConversations();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const updateConversations = async () => {
await conversationRepository.loadMissingConversations();
};
void updateConversations();
void conversationRepository.loadMissingConversations();

this.logger.error(`Failed to get all conversations from backend: ${error.message}`);
return {found: [], failed: missingConversations} as RemoteConversations;
});
missingConversations.splice(0, missingConversations.length);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
missingConversations.splice(0, missingConversations.length);
this.conversationState.missingConversations = [];

more straightforward and easier to understand I believe

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this might be a bug, you don't want to reset the state when the request failed.
There might be some things to improve there.

You only want to remove the ones that were succesfully fetched on backend

Co-authored-by: Przemysław Jóźwik <przemyslaw.jozwik@wire.com>
@V-Gira V-Gira merged commit 6d377c5 into dev May 9, 2023
13 checks passed
@V-Gira V-Gira deleted the virgile/refetch-conversations-on-search branch May 9, 2023 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants