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

[#1768] bad calls to conversations info when opening inbox #1775

Merged

Conversation

AudreyKj
Copy link
Contributor

closes #1768

@github-actions github-actions bot added the fix label May 11, 2021
@AudreyKj AudreyKj marked this pull request as ready for review May 11, 2021 15:23
.catch(async (error: Error) => {
if (retries > 5) {
.catch(async (error: ConversationInfoError) => {
if (retries > 5 || error.status === 404) {
return Promise.reject(error);
} else {
Copy link
Contributor Author

@AudreyKj AudreyKj May 11, 2021

Choose a reason for hiding this comment

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

if the conversation Id is not found, we return and do not fetch again to avoid loops

Copy link
Contributor

Choose a reason for hiding this comment

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

The loop is necessary to find the conversation when we get a websocket notification. If we remove this loop we won't be able to display conversations that come from ws because sometimes some metadata updates arrive even before the actual conversation.

export interface ConversationInfoError extends Error {
status: number;
body?: any;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a custom Error type to check the error's status

getConversationInfo(match.params.conversationId);
}
}, [conversations]);
}, [currentConversation, match.params.conversationId]);

const hideSuggestedReplies = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there was a 404 loop when opening inbox because the endpoint was called even if there was no conversation ID

@AudreyKj AudreyKj merged commit 35e617a into develop May 17, 2021
@AudreyKj AudreyKj deleted the fix/1768-bad-calls-to-conversations-info-when-opening-inbox branch May 17, 2021 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad calls to conversations.info when opening inbox
3 participants