Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

clear old pinned items stored in wrong position #12968

Merged
merged 1 commit into from
Feb 7, 2018

Conversation

cezaraugusto
Copy link
Contributor

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:

  1. checkout 0.19.x
  2. Visit some websites, restart browser a couple times until some tiles start disappearing, you'll reach a point where only twitter is shown
  3. Switch to 0.20.x
  4. Top sites should be populated with sites you visited in step 1

@cezaraugusto cezaraugusto added this to the 0.20.x Hotfix 1 (Referral Promotion) milestone Feb 1, 2018
@cezaraugusto cezaraugusto self-assigned this Feb 1, 2018
@codecov-io
Copy link

codecov-io commented Feb 1, 2018

Codecov Report

Merging #12968 into master will increase coverage by <.01%.
The diff coverage is 83.33%.

@@            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
Flag Coverage Δ
#unittest 56.14% <83.33%> (ø) ⬆️
Impacted Files Coverage Δ
app/sessionStore.js 88.57% <83.33%> (+0.07%) ⬆️

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]
Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Member

@petemill petemill left a 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

@petemill petemill merged commit 281be81 into master Feb 7, 2018
@petemill petemill deleted the topsites/pinned/12941 branch February 7, 2018 19:00
petemill added a commit that referenced this pull request Feb 7, 2018
clear old pinned items stored in wrong position
petemill added a commit that referenced this pull request Feb 7, 2018
clear old pinned items stored in wrong position
petemill added a commit that referenced this pull request Feb 7, 2018
clear old pinned items stored in wrong position
@petemill
Copy link
Member

petemill commented Feb 7, 2018

0.22.x 9404363
0.21.x 5bc903f
0.20.x 9f7fe12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

top site tiles not being populated when updating profile from 0.19.147
3 participants