OpenGenus / quark

Stay happy while offline | World's first offline search engine.
https://chrome.google.com/webstore/detail/opengenus-offline-search/lfoloadpfjildomeafpdopahkdaoofbn
GNU General Public License v3.0
618 stars 112 forks source link

Bug found on Favorites tab #83

Open nj2237 opened 6 years ago

nj2237 commented 6 years ago

This is a(n):

Details:

On double-clicking the 'Favorites', two columns of bookmarks appear.

opengenus-fav-bug

AnkitaKhurana commented 6 years ago

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. bmark

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?

nj2237 commented 6 years ago

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?

AnkitaKhurana commented 6 years ago

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

@AdiChat please help us here to find the right approach and possible reason for this error of different OS handling the same code differently.

nj2237 commented 6 years ago

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!

nj2237 commented 6 years ago

@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!

AnkitaKhurana commented 6 years ago

@nj2237 you are welcome :+1: Glad I could help :tada: