Skip to content

Commit

Permalink
Fixes cache migration from 0.19 to 0.20
Browse files Browse the repository at this point in the history
Resolves brave#10595

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Jan 23, 2018
1 parent a3b96a2 commit 2e9f71c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,10 @@ module.exports.runPreMigrations = (data) => {
}

// Add cache to the state
data.cache = {}
if (!data.cache) {
data.cache = {}
}

data.cache.bookmarkLocation = data.locationSiteKeysCache
data.cache.bookmarkOrder = sortBookmarkOrder(bookmarkOrder)

Expand Down
6 changes: 3 additions & 3 deletions test/unit/app/sessionStoreTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ describe('sessionStore unit tests', function () {
'12': {}
},
cache: {
fakeEntry: {}
ledgerVideos: {}
},
history: {
'https://not-a-real-entry|0': {}
Expand Down Expand Up @@ -1700,8 +1700,8 @@ describe('sessionStore unit tests', function () {
it('creates an entry for bookmark order', function () {
assert(newValue.bookmarkOrder)
})
it('destroys any existing values in `data.cache`', function () {
assert.equal(newValue.fakeEntry, undefined)
it('keep any existing values in `data.cache`', function () {
assert(newValue.ledgerVideos)
})
})

Expand Down

0 comments on commit 2e9f71c

Please sign in to comment.