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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,16 @@ module.exports.runPreMigrations = (data) => {
if (data.cache) {
delete data.cache.bookmarkLocation
}

// pinned top sites were stored in the wrong position in 0.19.x
// allowing duplicated items. See #12941
// in this case eliminate pinned items so they can be properly
// populated in their own indexes
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

}
}
}

Expand Down