From 85788d3c4a1de1c866314ede9952258c891e9700 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 27 Mar 2018 12:13:46 -0400 Subject: [PATCH] Match `items` storage format to Backbone adapter --- js/modules/messages_data_migrator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/modules/messages_data_migrator.js b/js/modules/messages_data_migrator.js index 7b07ad03ca03..047243b71067 100644 --- a/js/modules/messages_data_migrator.js +++ b/js/modules/messages_data_migrator.js @@ -97,7 +97,7 @@ exports.processAll = async ({ let unprocessedMessages = []; do { // eslint-disable-next-line no-await-in-loop - const lastProcessedIndex = (await getLastProcessedIndex(connection)) || null; + const lastProcessedIndex = await getLastProcessedIndex(connection); const fetchUnprocessedMessagesStartTime = Date.now(); unprocessedMessages = @@ -284,7 +284,7 @@ const getItem = (connection, key) => { reject(event.target.error); request.onsuccess = event => - resolve(event.target.result); + resolve(event.target.result ? event.target.result.value : null); }); }; @@ -299,7 +299,7 @@ const setItem = (connection, key, value) => { const transaction = connection.transaction(ITEMS_STORE_NAME, 'readwrite'); const itemsStore = transaction.objectStore(ITEMS_STORE_NAME); - const request = itemsStore.put(value, key); + const request = itemsStore.put({id: key, value}, key); return new Promise((resolve, reject) => { request.onerror = event => reject(event.target.error);