add solution#1353
Conversation
GabrielSpelchuk
commented
Feb 20, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job setting up the promises and the UI feedback system! The implementation for thirdPromise is spot on.
However, changes are needed for firstPromise and secondPromise due to a critical issue with the event listeners. Using the { once: true } option causes the listener to be removed after the very first click, no matter which mouse button is used. For example, if a user right-clicks first, the listener for firstPromise is removed, and any later left-clicks are ignored, causing the promise to be incorrectly rejected by the timeout.
To fix this, please remove { once: true } and instead, manually remove the event listener from within the handler function only after the condition to resolve the promise has been met.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| resolve('First promise was resolved'); | ||
| } | ||
| }, | ||
| { once: true }, |
There was a problem hiding this comment.
The { once: true } option causes a bug here. It removes the event listener after the very first click, regardless of which button was pressed. If that first click is not a left click (e.g., a right click), the listener is removed, and subsequent left clicks won't be detected. This will cause the promise to be incorrectly rejected by the timeout instead of being resolved.
| resolve('Second promise was resolved'); | ||
| } | ||
| }, | ||
| { once: true }, |
There was a problem hiding this comment.
Similar to the firstPromise, using { once: true } is incorrect here. If the user's first click is a middle click, the listener will be removed, and the promise will never resolve because it can no longer listen for the required left or right clicks. The event listener should remain active until either a left or right click occurs.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this task! I'm happy to approve your solution. You've successfully implemented all the requirements for the three promises, and the logic for handling the different click events and timeouts is spot-on. Most importantly, you've perfectly addressed the previous feedback by manually removing the event listeners after the promises are settled. The code is clean, correct, and works exactly as expected. Great job!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨