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

fix: messages overlap when switching tabs too quickly #10511

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

JoaoLive100
Copy link

Pull Request Template

Description

When switching between message categories ('All Conversations', 'Mentions', 'Unattended'), the messages displayed should correspond to the selected category. If I switch categories quickly, messages from the previously selected category sometimes appear in the new one. It seems that messages from one category are being loaded into another due to some delay or overlapping request handling.

An incremental identifier ensures that only the data from the most recent request is processed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

Simulated rapid switching between message categories ('All Conversations', 'Mentions', and 'Unattended') to replicate the conditions where messages from one category were loaded into another. After the code update, performed the same rapid switching to confirm that messages now load correctly and correspond to the selected category without overlap.

Checklist:

  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@pranavrajs
Copy link
Member

@JoaoLive100 Thanks for the PR. I understand the issue. However, I believe the most suitable solution is to utilize AbortController, as it’s natively available and eliminates the need for managing counters. Let me know what you think.

https://developer.mozilla.org/en-US/docs/Web/API/AbortController

@JoaoLive100
Copy link
Author

@pranavrajs I made the changes implementing the AbortController. It’s a solution I wasn’t familiar with, but it achieved the expected result in addressing the issue. What do you think of the current implementation? Please proceed with your review.

Copy link

github-actions bot commented Jan 5, 2025

🐢 Turtley slow progress alert! This pull request has been idle for over 30 days. Can we please speed things up and either merge it or release it back into the wild?

@github-actions github-actions bot added the stale label Jan 5, 2025
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.

2 participants