From 3b0f079a2f494181ec1feb186d39af9bde812431 Mon Sep 17 00:00:00 2001 From: Index Date: Tue, 2 Jul 2024 14:29:19 -0500 Subject: [PATCH] fix: fix avatar sandbox load user overwriting cache --- js/account/avatar-sandbox-rewrite.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/js/account/avatar-sandbox-rewrite.js b/js/account/avatar-sandbox-rewrite.js index 73ece9f..006a78a 100644 --- a/js/account/avatar-sandbox-rewrite.js +++ b/js/account/avatar-sandbox-rewrite.js @@ -384,19 +384,21 @@ async function LoadUser(id) { Avatar.items = []; data.assets.forEach((item) => { - ItemCache[item.id] = { - type: item.type, - name: item.name, - price: null, - creator: null, - thumbnail: item.thumbnail, - asset: item.path - } - - if (item.type === 'hat' || item.type === 'tool') { - ItemCache[item.id].creator = { - id: 1, - name: "Polytoria" + if (ItemCache[item.id] === undefined) { + ItemCache[item.id] = { + type: item.type, + name: item.name, + price: null, + creator: null, + thumbnail: item.thumbnail, + asset: item.path + } + + if (item.type === 'hat' || item.type === 'tool' || item.type === 'torso') { + ItemCache[item.id].creator = { + id: 1, + name: "Polytoria" + } } }