Skip to content

Update Sortium - #293

Open
SalvadorCorreia wants to merge 2 commits into
SteamClientHomebrew:mainfrom
SalvadorCorreia:main
Open

SalvadorCorreia wants to merge 2 commits into
SteamClientHomebrew:mainfrom
SalvadorCorreia:main

Conversation

@SalvadorCorreia

Copy link
Copy Markdown
Contributor

Sortium

Sortium v2.0.0 update. Advanced library sorting for the Steam client based on global completion metrics.
This major update migrates Sortium directly into Steam's native library UI, replacing the legacy custom overlay grid and capsules with native VDOM and prototype hooks. Users can now sort collections by HowLongToBeat and Steam Hunters metrics directly from Steam's native Sort By dropdown, group games into automatic native section shelves (e.g., Over 100 Hours, Over 90%), view metric badges on native game capsules, toggle ascending/descending order on both custom and built-in Steam sort options, and hide unwanted default Steam sort options from the settings menu.

Task Checklist

Developer

  • My plugin complies with the plugin submission guidelines
  • I am the original author or an authorized maintainer of this plugin.
  • I have complied with all license requirements for the libraries used, including providing appropriate notices where necessary.
  • My plugin is fully open source and does not depend on any external paid services, except for widely trusted and well-known platforms. Additionally, neither I nor anyone associated with me profits from any such services.
  • Generative AI was used for most of the plugin's code.

Plugin Functionality

  • I have tested the plugin on both the Stable and Beta Steam update channels.

Backend Configuration

  • I use a standard Millennium Lua backend in my plugin.
  • I use custom binaries that or rely on other FOSS projects that aren't written directly using Millennium's Lua backend.

Community Contribution

  • I have tested and left feedback on two other plugin pull requests.
  • I have added links to those feedback comments in this PR.

Testing Instructions

  • Verified by a third party on Steam Client Stable.
  • Verified by a third party on Steam Client Beta.

@github-actions github-actions Bot changed the title Update Sortium V2.0.0 Update Sortium Nov 2, 2026

@ricewind012 ricewind012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just skimmed through the frontend, so there may be another one when I get the time for it.

  • cache findModule* values so it doesn't get called on each context menu
  • use {after,before,replace}Patch, I think you can most likely avoid cloneElement this way
  • PLEASE do not patch Array.prototype.sort (and context menu stuff maybe?), there has to be a better way of doing this dude

I hope you wrote the architecture.md yourself, it's pretty cool. This has to be a crime btw wtf SalvadorCorreia/Sortium@7c10569

@SalvadorCorreia

Copy link
Copy Markdown
Contributor Author

Haha fair enough, 7c10569 was definitely a war crime. Spoofing eSortBy = 5 and hijacking GetLastPlayedSectionName inside Array.prototype.sort (plus that wall of nested ternaries in sorting.ts) was a late-night desperate attempt at making everything just work. I tried to make everything a little cleaner but it still isn't as pretty as I wish it could be.
About architecture.md, I needed an AI's help to make mermaid look good, I am not great at writing it, but still loved the process of making sure that the system made sense and that edge cases were represented!

Cleaned all of that up now:

  • Cached findModule* lookups: Moved all findModule / findModuleExport calls out of the UI components (SortiumDirectionToggle, SortiumStreamStatus) and cached them once at module scope in resolveSteamModules().
  • {replace,after}Patch instead of cloneElement: Switched SortingDropDown and the capsule wrapper over to @steambrew/client's replacePatch and afterPatch, mutating dropdownEl.props and vdom.props.children directly and cleaning up via .unpatch().
  • Killed the Array.prototype.sort & GetLastPlayedSectionName patches: Instead of globally patching Array.prototype.sort or spoofing Last Played, we now grab the childSections prop on the collection grid fiber right before it renders and group/reverse the section buckets in place (syncCollectionGridSections). Also replaced that giant ternary ladder in sorting.ts with a lookup table.

Also did a pass over the Lua backend while I was at it (added in-memory chunk caching so GetCacheBatch doesn't re-read/decode disk JSON on every batch, atomic .tmp writes for settings, and deduplicated the HTTP stream helpers).

Appreciate the review!!!
Let me know if you spot anything else when you get a chance to look through the rest!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants