Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/lib/components/inventory/selected_item_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,27 @@ export class SelectedItemInfo extends FloatElement {
(isCharm(this.asset.description) && !isHighlightCharm(this.asset.description)))
) {
try {
this.itemInfo = await gFloatFetcher.fetch({
asset_id: this.asset.assetid,
link: this.inspectLink,
const asset = this.asset;
if (!asset) return;

const inspectLink = this.inspectLink;
if (!inspectLink) return;

const fetched = await gFloatFetcher.fetch({
asset_id: asset.assetid,
link: inspectLink,
});

if (this.asset?.assetid !== asset.assetid) {
return;
}

this.itemInfo = {
...fetched,
full_item_name: asset.description.market_hash_name,
};
Comment on lines +279 to +282

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combining data points from different sources will make this process harder to reproduce in other places (e.g. the same issue occurs in our SCM enhancements).

I would prefer reusing our existing solution from fetch_inspect_info.ts

const stattrak = decoded.killeaterscoretype !== undefined;
const souvenir = decoded.quality === 12;

and just modify the string parsing in getFloatDbCategory to use the available info.

We could remove full_item_name from ItemInfo to make this a bit more clear.

} catch (e: any) {
console.error(`Failed to fetch float for ${this.asset.assetid}: ${e.toString()}`);
console.error(`Failed to fetch float for ${this.asset?.assetid}: ${e.toString()}`);
}

// Fetch bluegem data if needed
Expand Down