summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/search/store/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/search/store/utils.js')
-rw-r--r--app/assets/javascripts/search/store/utils.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/assets/javascripts/search/store/utils.js b/app/assets/javascripts/search/store/utils.js
index 60c09221ca9..b7d97213594 100644
--- a/app/assets/javascripts/search/store/utils.js
+++ b/app/assets/javascripts/search/store/utils.js
@@ -21,7 +21,7 @@ export const loadDataFromLS = (key) => {
export const setFrequentItemToLS = (key, data, itemData) => {
if (!AccessorUtilities.isLocalStorageAccessSafe()) {
- return;
+ return [];
}
const keyList = [
@@ -66,9 +66,11 @@ export const setFrequentItemToLS = (key, data, itemData) => {
// Note we do not need to commit a mutation here as immediately after this we refresh the page to
// update the search results.
localStorage.setItem(key, JSON.stringify(frequentItems));
+ return frequentItems;
} catch {
// The LS got in a bad state, let's wipe it
localStorage.removeItem(key);
+ return [];
}
};