From 6b6b0af8199604b6a481e29c018f9983c2d9333f Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 31 May 2020 21:38:07 +0200 Subject: [PATCH] Fix error when adding a background to a list which did not have one before --- src/store/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index e0c5a9b6..70ba25ff 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -46,10 +46,20 @@ export const store = new Vuex.Store({ [CURRENT_LIST](state, currentList) { // Not sure if this is the right way to do it but hey, it works if ( + // List changed currentList.id !== state.currentList.id || + // The current list got a new background and didn't have one previously + ( + currentList.backgroundInformation && + !state.currentList.backgroundInformation + ) || + // The current list got a new background and had one previously ( currentList.backgroundInformation && currentList.backgroundInformation.unsplashId && + state.currentList && + state.currentList.backgroundInformation && + state.currentList.backgroundInformation.unsplashId && currentList.backgroundInformation.unsplashId !== state.currentList.backgroundInformation.unsplashId ) ) {