From 796ca1f41336db7d1d37560b5ad30208d05bee84 Mon Sep 17 00:00:00 2001 From: An Phan Date: Sat, 17 Dec 2016 16:10:08 +0800 Subject: [PATCH] Fix tests --- resources/assets/js/stores/album.js | 5 ++++- resources/assets/js/stores/artist.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/stores/album.js b/resources/assets/js/stores/album.js index 20c3fa79..99006ec3 100644 --- a/resources/assets/js/stores/album.js +++ b/resources/assets/js/stores/album.js @@ -1,5 +1,5 @@ import Vue from 'vue' -import { reduce, each, find, union, difference, take, filter, orderBy } from 'lodash' +import { reduce, each, union, difference, take, filter, orderBy } from 'lodash' import { secondsToHis } from '../utils' import stub from '../stubs/album' @@ -151,6 +151,9 @@ export const albumStore = { // Remove from the artist as well each(albums, album => { artistStore.removeAlbumsFromArtist(album.artist, album) + + // Delete the cache while we're here + delete this.cache[album.id] }) }, diff --git a/resources/assets/js/stores/artist.js b/resources/assets/js/stores/artist.js index 6930077f..b7602b35 100644 --- a/resources/assets/js/stores/artist.js +++ b/resources/assets/js/stores/artist.js @@ -1,5 +1,5 @@ import Vue from 'vue' -import { reduce, each, find, union, difference, take, filter, orderBy } from 'lodash' +import { reduce, each, union, difference, take, filter, orderBy } from 'lodash' import config from '../config' import stub from '../stubs/artist' @@ -98,7 +98,6 @@ export const artistStore = { each(artists, a => this.setupArtist(a)) this.all = union(this.all, artists) - }, /** @@ -107,7 +106,13 @@ export const artistStore = { * @param {Array.|Object} artists */ remove (artists) { - this.all = difference(this.all, [].concat(artists)) + artists = [].concat(artists) + this.all = difference(this.all, artists) + + // Remember to clear the cache + each(artists, artist => { + delete this.cache[artist.id] + }) }, /**