Skip to content

Fix Float Rank hyperlinks for Souvenirs/StatTraks#405

Open
rxl211 wants to merge 4 commits into
csfloat:masterfrom
rxl211:master
Open

Fix Float Rank hyperlinks for Souvenirs/StatTraks#405
rxl211 wants to merge 4 commits into
csfloat:masterfrom
rxl211:master

Conversation

@rxl211

@rxl211 rxl211 commented Jun 29, 2026

Copy link
Copy Markdown

I noticed that on Steam inventories, when you selected a StatTrak or Souvenir item and it had a displayed float Rank, clicking on the link would always take you to the database with a category=1 (Normal) filter selected, even though the selected item was StatTrak/souvenir.

Example:
image

The root cause seemed to be that the itemInfo.full_item_name field was never populated, and so downstream code which looks at full_item_name to derive the correct category filter when constructing the hyperlink would always just default to category=1.

This PR includes a change to selected_item_info.ts to populate full_item_name inside of processSelectChange().

I verified this fixes the bug locally by loading the unpackaged extension in Chrome. I did not test on Firefox.


Note

Low Risk
Small change to outbound Float DB URL construction for rank links; no auth, data, or payment impact.

Overview
Fixes Float Rank links on Steam inventory items so StatTrak and Souvenir skins open csfloat.com/db with the correct category filter instead of always using Normal (category=1).

Inspect handling now sets is_souvenir and is_stattrak on ItemInfo from decoded inspect data (souvenir quality 12, StatTrak via killeaterscoretype). getFloatDbLink uses those flags for category selection (StatTrak → 2, Souvenir → 3, normal → 1) rather than substring checks on full_item_name, which was often unset. If either flag is missing, the link uses category=0 (unfiltered) instead of incorrectly defaulting to Normal.

Reviewed by Cursor Bugbot for commit 86d9c5c. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6f5342d. Configure here.

Comment thread src/lib/components/inventory/selected_item_info.ts Outdated

@GODrums GODrums left a comment

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.

Thanks for the contribution and finding this bug! Added a small comment to make our parsing a bit more reliable and resolve the issue in SCM as well

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

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@GODrums thanks, I wasn't thinking about SCM! I did initially look at getFloatDbCategory but the problem I ran into is that ItemInfo doesn't contain anything to infer StatTrak from. I see now that you can infer souvenir by quality == 12 though, so that can be done easily.

Are you suggesting adding an is_stattrak property to ItemInfo in fetch_inspect_info.ts? I'm still unsure of what a common area would be to fill in the property. I tried doing so in fetch_inspect_info.ts but my new fields never showed up when I tried outputting the ItemInfo object to console.

I'm also not sure what kind of caching exists in the extension. But that's not the reason I don't think it was working for me because I tried going to SCM pages I had never been to before.

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.

As shown in the code sample above, you can determine if an item is StatTrak by checking if killeaterscoretype is defined on the decoded inspect link.

Given that these checks are simple, there should be no need to persist them in itemInfo, you may just replace the string parsing with those checks in getFloatDbCategory

@rxl211 rxl211 Jun 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I got it working with the decoded inspect link, but since getFloatDbCategory didn't seem to already have an inspect link handy I had to plumb it through.

@GODrums GODrums Jun 30, 2026

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.

My bad, missed that. In that case, feel free to annotate those states (stattrak, souvenir) in ItemInfo.
Performance-wise we should avoid running multiple decodings if not absolutely necessary, especially not in injected scripts.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@GODrums ok thanks. I have a version working where the fields are set in processInspectItem() but I initially wasn't seeing my new fields show up in the ItemInfo that getFloatDbCategory had. At first I fixed it by deleting threshold_cache in Chrome devtools but later wasn't able to repro.

In short, are there any cache considerations to keep in mind when existing users upgrade / are there cases where ItemInfo does not update (and thus skips the new fields) for items users have recently looked at or something like that?

Either way, I reverted the last change and pushed the latest version so you can take a look. I'm going out of town for 7 days so won't be able to get to any edits until next week.

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.

Thanks, looking much more simple now!

Most likely this happened because the extension's HMR in dev-mode only reloads changed files (but not cache-related files for example). This is generally not a concern for production extension updates as those reload the whole extension.

@rxl211 rxl211 requested a review from GODrums June 30, 2026 16:52
Comment thread src/lib/utils/skin.ts
Comment on lines +77 to +78
if (item.is_souvenir == null || item.is_stattrak == null) {
return 0; //unfiltered

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.

Is this check necessary? Applying the "normal" category should work for non-skins as well afaik

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

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.

Thanks, looking much more simple now!

Most likely this happened because the extension's HMR in dev-mode only reloads changed files (but not cache-related files for example). This is generally not a concern for production extension updates as those reload the whole extension.

@GODrums

GODrums commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Please also ensure to run the linter so our tests pass (npm run lint)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants