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 multiple overlapping card in a stack due to spam clicking #1087

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

FadhlanR
Copy link
Contributor

@FadhlanR FadhlanR commented Mar 12, 2024

Ticket: CS-6590

This PR addresses an issue where multiple overlapping cards could appear in a stack if the user spam-clicked the card grid item. To prevent this, I've implemented a mechanism to disallow multiple cards with the same ID from being opened in a stack. Additionally, if there are duplicate cards in a stack, the latest one will be opened at the top of the stack. While it's unlikely that we'd need multiple cards with the same ID in a stack, I'm open to exploring alternative approaches to resolve this issue.

Based on @jurgenwerk 's feedback, I updated the approach to solve this issue by using dropTask.

Copy link

github-actions bot commented Mar 12, 2024

Test Results

528 tests  +1   524 ✔️ +1   7m 15s ⏱️ +7s
    1 suites ±0       4 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit c386554. ± Comparison against base commit 755a1da.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@jurgenwerk jurgenwerk left a comment

Choose a reason for hiding this comment

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

I am not able to reproduce this locally, but I tried double clicking on current staging where things are currently not the fastest and I was able to reproduce this by a quick double click on the grid item where 2 of the same cards opened on the stack.

I am wondering if this could be solved by changing the type of viewCard task from restartable to drop (i.e. ignore subsequent attempts if the attempted card did not open yet)

@FadhlanR
Copy link
Contributor Author

FadhlanR commented Mar 12, 2024

I am not able to reproduce this locally, but I tried double clicking on current staging where things are currently not the fastest and I was able to reproduce this by a quick double click on the grid item where 2 of the same cards opened on the stack.

I am wondering if this could be solved by changing the type of viewCard task from restartable to drop (i.e. ignore subsequent attempts if the attempted card did not open yet)

I attempted to update the viewCard function with dropTask, but the test failed because duplicate cards can still appear in the stack. (EDIT)

It works using dropTask and I updated the test. 7f01263

@FadhlanR FadhlanR requested a review from jurgenwerk March 13, 2024 09:34
Copy link
Contributor

@tintinthong tintinthong left a comment

Choose a reason for hiding this comment

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

Lgtm. I think it seems right to use dropTask

@FadhlanR FadhlanR merged commit 5b6fb0f into main Mar 13, 2024
18 checks passed
@delete-merged-branch delete-merged-branch bot deleted the cs-6590-fix-multiple-overlapping-card-spam-clicking branch March 13, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants