Skip to content

Commit fa2ed8d

Browse files
Avoid an error on the item market when switching categories.
1 parent 3a51360 commit fa2ed8d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

extension/changelog.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"date": false,
66
"logs": {
77
"features": [],
8-
"fixes": [{ "message": "Correctly count the supply pack value.", "contributor": "DeKleineKobini" }],
8+
"fixes": [
9+
{ "message": "Correctly count the supply pack value.", "contributor": "DeKleineKobini" },
10+
{ "message": "Avoid an error on the item market when switching categories.", "contributor": "DeKleineKobini" }
11+
],
912
"changes": [{ "message": "Better optimize calls to tornpal.", "contributor": "DeKleineKobini" }],
1013
"removed": []
1114
}

extension/scripts/content/itemmarket/ttItemMarket.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@
5252

5353
triggerCustomListener(EVENT_CHANNELS.ITEMMARKET_CATEGORY_ITEMS, { list });
5454
[...list.findAll("[class*='itemList___'] > li")].forEach((itemElement) => {
55+
const priceElement = itemElement.find("[class*='priceAndTotal___'] span:first-child");
56+
if (!priceElement) return;
57+
5558
new MutationObserver(() => {
5659
triggerCustomListener(EVENT_CHANNELS.ITEMMARKET_CATEGORY_ITEMS_UPDATE, { item: itemElement });
57-
}).observe(itemElement.find("[class*='priceAndTotal___'] span:first-child"), { subtree: true, characterData: true });
60+
}).observe(priceElement, { subtree: true, characterData: true });
5861
});
5962
if (!mobile && !tablet) {
6063
new MutationObserver(async (mutations) => {

0 commit comments

Comments
 (0)