Skip to content

Add sorting to add-modifier list#9785

Open
mcagnion wants to merge 1 commit intoPathOfBuildingCommunity:devfrom
mcagnion:feature/sort-add-modifier-list
Open

Add sorting to add-modifier list#9785
mcagnion wants to merge 1 commit intoPathOfBuildingCommunity:devfrom
mcagnion:feature/sort-add-modifier-list

Conversation

@mcagnion
Copy link
Copy Markdown
Contributor

@mcagnion mcagnion commented Apr 19, 2026

Description of the problem being solved:

The "Add Modifier to Item" popup in the Items tab lists candidate mods for every source available on the item — prefix / suffix / implicit tiers, bench/master crafts, essences, veiled mods, crafted mods, influenced mods — in source order. When picking between dozens of candidates the user has to eyeball which one most helps the current build, regardless of source.

This PR adds a Sort dropdown to the popup. The metrics are drawn from data.powerStatList (same source as CompareTab, ItemDBControl, NotableDBControl, SkillsTab, TradeQuery, and RadiusJewelData), so the available sorts stay in sync with every other sort surface in PoB. Selecting a stat recomputes each candidate against the current build via calcsTab:GetMiscCalculator() and orders them by the resulting output value. "Default" restores the original source order. The sort applies to the current Source filter, so switching Source re-applies automatically with cached values.

Steps taken to verify a working solution:

  • Ran busted --run=quick --lua=luajit --output=gtest ../spec (full spec tree) and got 208 successes / 0 failures / 0 errors in 32 s.
  • Manually verified in the Items tab that:
    • The Sort dropdown is populated with every eligible data.powerStatList entry.
    • Sorting by Life, Effective Hit Pool, Life Regen, Armour, etc., promotes the expected mods on a sample build.
    • The sort respects the current Source filter (e.g., Source = Suffix + Sort = Life Regen lists only suffix mods ordered by life regen gained).
    • Switching between Source types re-applies the current sort.
    • Selecting Default restores the original source order.
    • The cached sortValues table avoids re-computing when the user switches back to a previously-selected stat.

Before — popup without Sort dropdown:

before-sort-dropdown

After — sorted by Life:

after-sort-by-life UPLOADED_URL)

After — sorted by Effective Hit Pool:

after-sort-by-ehp

After — Source = Suffix, sorted by Life Regen:

after-sort-suffix-by-liferegen

@mcagnion mcagnion marked this pull request as ready for review April 19, 2026 19:55
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.

1 participant