From 32f8a75e8de1b1df30cffe610e1d51032edd97a8 Mon Sep 17 00:00:00 2001 From: Alexander Heimbuch Date: Wed, 8 Mar 2017 18:28:02 +0100 Subject: [PATCH] fix(persist): Fixes issue with object-hash library, use hashed title as identifier --- package.json | 2 +- src/components/tabs/settings/Settings.vue | 2 +- src/store/effects/storage.js | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fac9fdaf4..5a825c22d 100644 --- a/package.json +++ b/package.json @@ -67,13 +67,13 @@ "howler": "^2.0.2", "iframe-resizer": "^3.5.7", "lodash": "^4.17.3", - "object-hash": "^1.1.5", "query-string": "^4.3.1", "react": "15.3.0", "react-dom": "15.3.0", "react-redux": "4.4.5", "redux": "3.5.2", "revue": "^3.0.0", + "short-hash": "^1.0.0", "superagent": "^3.4.1", "viscroll": "^1.0.0", "vue": "^2.1.8" diff --git a/src/components/tabs/settings/Settings.vue b/src/components/tabs/settings/Settings.vue index cca75a739..19f4620c9 100644 --- a/src/components/tabs/settings/Settings.vue +++ b/src/components/tabs/settings/Settings.vue @@ -1,6 +1,6 @@ diff --git a/src/store/effects/storage.js b/src/store/effects/storage.js index f92a4f009..e8724058c 100644 --- a/src/store/effects/storage.js +++ b/src/store/effects/storage.js @@ -1,14 +1,18 @@ import actions from '../actions' import storage from 'utils/storage' -import hash from 'object-hash' +import hash from 'short-hash' let podloveStorage export default (store, action) => { switch (action.type) { case 'INIT': - podloveStorage = storage(hash(action.payload)) + if (!action.payload.title) { + return + } + + podloveStorage = storage(hash(action.payload.title)) let storedPlaytime = podloveStorage.get('playtime') @@ -18,6 +22,10 @@ export default (store, action) => { } break case 'SET_PLAYTIME': + if (!podloveStorage) { + return + } + podloveStorage.set('playtime', action.payload) break }