-
Notifications
You must be signed in to change notification settings - Fork 973
clear old pinned items stored in wrong position #12968
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12968 +/- ##
==========================================
+ Coverage 56.14% 56.14% +<.01%
==========================================
Files 279 279
Lines 27326 27331 +5
Branches 4443 4444 +1
==========================================
+ Hits 15341 15346 +5
Misses 11985 11985
|
if (data.about.newtab.pinnedTopSites) { | ||
// Empty array is currently set to include default pinned sites | ||
// which we avoid given the user already have a profile | ||
data.about.newtab.pinnedTopSites = [null] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we're setting this to an array with one null
item inside and not an empty array with []
@cezaraugusto ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://github.com/brave/browser-laptop/blob/master/app/common/state/aboutNewTabState.js#L41 an empty array would populate top sites with default pinned site, which should only happen on an empty profile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested:
✅ clears any pinned top sites from 0.19 after upgrade to later version
✅ later version still remembers newly-pinned top sites after restart
clear old pinned items stored in wrong position
clear old pinned items stored in wrong position
clear old pinned items stored in wrong position
fix #12941
TL;DR: The bug is caused because pinned top sites were stored in a wrong position -- instead of own index they were pushed to the first index, causing duplicates. Since duplicated keys are hidden you ended up having only one tile.
The fix cleans pinned top sites from the previous version.
Test Plan: