Fix error when adding a background to a list which did not have one before

This commit is contained in:
kolaente 2020-05-31 21:38:07 +02:00
parent 3441072c2c
commit 6b6b0af819
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -46,10 +46,20 @@ export const store = new Vuex.Store({
[CURRENT_LIST](state, currentList) { [CURRENT_LIST](state, currentList) {
// Not sure if this is the right way to do it but hey, it works // Not sure if this is the right way to do it but hey, it works
if ( if (
// List changed
currentList.id !== state.currentList.id || 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 &&
currentList.backgroundInformation.unsplashId && currentList.backgroundInformation.unsplashId &&
state.currentList &&
state.currentList.backgroundInformation &&
state.currentList.backgroundInformation.unsplashId &&
currentList.backgroundInformation.unsplashId !== state.currentList.backgroundInformation.unsplashId currentList.backgroundInformation.unsplashId !== state.currentList.backgroundInformation.unsplashId
) )
) { ) {