Skip to content

Commit

Permalink
Avoid an error on the item market when switching categories.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeKleineKobini committed Jan 3, 2025
1 parent 3a51360 commit fa2ed8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"date": false,
"logs": {
"features": [],
"fixes": [{ "message": "Correctly count the supply pack value.", "contributor": "DeKleineKobini" }],
"fixes": [
{ "message": "Correctly count the supply pack value.", "contributor": "DeKleineKobini" },
{ "message": "Avoid an error on the item market when switching categories.", "contributor": "DeKleineKobini" }
],
"changes": [{ "message": "Better optimize calls to tornpal.", "contributor": "DeKleineKobini" }],
"removed": []
}
Expand Down
5 changes: 4 additions & 1 deletion extension/scripts/content/itemmarket/ttItemMarket.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@

triggerCustomListener(EVENT_CHANNELS.ITEMMARKET_CATEGORY_ITEMS, { list });
[...list.findAll("[class*='itemList___'] > li")].forEach((itemElement) => {
const priceElement = itemElement.find("[class*='priceAndTotal___'] span:first-child");
if (!priceElement) return;

new MutationObserver(() => {
triggerCustomListener(EVENT_CHANNELS.ITEMMARKET_CATEGORY_ITEMS_UPDATE, { item: itemElement });
}).observe(itemElement.find("[class*='priceAndTotal___'] span:first-child"), { subtree: true, characterData: true });
}).observe(priceElement, { subtree: true, characterData: true });
});
if (!mobile && !tablet) {
new MutationObserver(async (mutations) => {
Expand Down

0 comments on commit fa2ed8d

Please sign in to comment.