quark
quark copied to clipboard
Bug found on Favorites tab
This is a(n):
- [ ] New feature proposal
- [ ] Reporting a keyword
- [X] Error
- [ ] Proposal to the Search Engine
- [ ] Other
Details:
On double-clicking the 'Favorites', two columns of bookmarks appear.
Hi @nj2237
Thank you for pointing this out.
I tried to double click on the button to try this issue.
This is what I found.
It worked fine on my browser, so I checked the code to find the possible issue - the fav button calls
addFavorites
function which clears the 'Favorites area' before refreshing.
I am using - Chrome Version 64.0.3282.186 (Official Build) (64-bit) What is your browser version?
Hi @AnkitaKhurana Thanks for checking this! I am using - Chrome Version 64.0.3282.186 (Official Build) (32-bit) on Windows.
I checked on my Linux with the Chrome Version 64.0.3282.186 (Official Build) (64-bit) too. Here I am not getting this bug either.
What do you think?
Hi, @nj2237 is the error still there?
If yes, this might be happening due to asynchronous calls to the functions.
The addFavourites
is being called in an unexpected order. Thereby the .empty()
function is not working properly.
If you are working on this issue :
Try adding
-
Callbacks
in the code; they help in handling functions to make them synchronous if the default nature is asynchronous - If the code gets too messy with that approach try using our best syntactic sugar -
Promises
in Javascript.
@AdiChat please help us here to find the right approach and possible reason for this error of different OS handling the same code differently.
Hi @AnkitaKhurana Yes, the error is still there. I will look into the code like you've suggested and implement a fix for this. Thanks a lot!
@AdiChat I have created a PR that fixes this. Have verified it on both my Linux (where the bug was not there) and my Windows (where it was there).
@AnkitaKhurana Thank you for the suggestions, I had tried callbacks, but could not fix until I added a Promise that resolved it. The behavior was exactly equivalent to calling addFavorites()
twice (I called it twice in the code and single-clicked and put console logs to compare attribute values). So the only option that worked was adding a Promise.
Request to review, thanks!
@nj2237 you are welcome :+1: Glad I could help :tada: