-
Notifications
You must be signed in to change notification settings - Fork 44
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
[#1768] bad calls to conversations info when opening inbox #1775
Conversation
.catch(async (error: Error) => { | ||
if (retries > 5) { | ||
.catch(async (error: ConversationInfoError) => { | ||
if (retries > 5 || error.status === 404) { | ||
return Promise.reject(error); | ||
} else { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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 = () => { |
There was a problem hiding this comment.
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
closes #1768