From 844d3fbf37164412bc3b13fd2ed92315e0dd5330 Mon Sep 17 00:00:00 2001 From: negue Date: Sun, 10 Feb 2019 19:32:14 +0100 Subject: [PATCH] refresh gear overview (#10971) * refresh bought seasonal gear * just "subscribe" to the _v change instead of returning the value * subscribe in vue instead of lib --- .../components/shops/seasonal/index.vue | 2 ++ website/common/script/ops/pinnedGearUtils.js | 30 +++++-------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/website/client/components/shops/seasonal/index.vue b/website/client/components/shops/seasonal/index.vue index 97d0e9a653..4847bafa71 100644 --- a/website/client/components/shops/seasonal/index.vue +++ b/website/client/components/shops/seasonal/index.vue @@ -388,7 +388,9 @@ }, seasonal () { + // vue subscriptions, don't remove let backgroundUpdate = this.backgroundUpdate; // eslint-disable-line + const myUserVersion = this.user._v; // eslint-disable-line let seasonal = shops.getSeasonalShop(this.user); diff --git a/website/common/script/ops/pinnedGearUtils.js b/website/common/script/ops/pinnedGearUtils.js index c60660927e..2ec133509b 100644 --- a/website/common/script/ops/pinnedGearUtils.js +++ b/website/common/script/ops/pinnedGearUtils.js @@ -85,30 +85,16 @@ function removePinnedGearByClass (user) { } function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) { - let currentPinnedItems = selectGearToPin(user); - let removeAndAddAllItems = false; - - for (let item of currentPinnedItems) { - let itemInfo = getItemInfo(user, 'marketGear', item); - - if (itemInfo.path === itemPath) { - removeAndAddAllItems = true; - break; - } - } - removeItemByPath(user, itemPath); - if (removeAndAddAllItems) { - // an item of the users current "new" gear was bought - // remove the old pinned gear items and add the new gear back - removePinnedGearByClass(user); - user.items.gear.owned[newItemKey] = true; - addPinnedGearByClass(user); - } else { - // just change the new gear to owned - user.items.gear.owned[newItemKey] = true; - } + // an item of the users current "new" gear was bought + // remove the old pinned gear items and add the new gear back + removePinnedGearByClass(user); + user.items.gear.owned[newItemKey] = true; + addPinnedGearByClass(user); + + // update the version, so that vue can refresh the seasonal shop + user._v++; } /**