quark icon indicating copy to clipboard operation
quark copied to clipboard

Bug found on Favorites tab

Open nj2237 opened this issue 6 years ago • 6 comments

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.

opengenus-fav-bug

nj2237 avatar Mar 05 '18 15:03 nj2237

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?

AnkitaKhurana avatar Mar 05 '18 16:03 AnkitaKhurana

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?

nj2237 avatar Mar 06 '18 14:03 nj2237

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.

AnkitaKhurana avatar Mar 08 '18 04:03 AnkitaKhurana

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 avatar Mar 08 '18 16:03 nj2237

@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 avatar Mar 11 '18 18:03 nj2237

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

AnkitaKhurana avatar Mar 11 '18 18:03 AnkitaKhurana