Skip to content

Fix trader crashes on object-form mods, make Find best return URL only#5

Merged
pathanin merged 2 commits into
devfrom
trader-object-mods-and-url-only
Jul 25, 2026
Merged

Fix trader crashes on object-form mods, make Find best return URL only#5
pathanin merged 2 commits into
devfrom
trader-object-mods-and-url-only

Conversation

@pathanin

Copy link
Copy Markdown
Owner

Trade API object-form mods

The trade API migrated item mods from plain strings to objects ({description, flags}). Commit 2d09769 adapted explicitMods only, so any item with rune/enchant/implicit mods crashed:

Modules/Common.lua:1004: attempt to call method 'gsub' (a nil value)

escapeGGGString was being handed a table. Fixed with the format-agnostic idiom already ported into ImportTab.lua:1333, applied to all four mod loops plus pseudoMods, which crashed the same way one line later on :match.

Also fixes a pre-existing crash on an empty pseudoMods array — the old pseudoMods and pseudoMods[1]:match(...) indexed nil instead of falling back to "0".

"Find best" returns the URL only

Swapped SearchWithQueryWeightAdjusted (search → fetch every result block → parse → sort → populate dropdown) for a bare PerformSearch, which is just the search POST that returns the query ID. The row now stays on [Find best][url][Price Item] rather than flipping to the result dropdown. Price Item still works on that URL when the items are actually wanted.

Known consequence: the Augment/Anoint Behaviour dropdowns in the Find best dialog (TradeQueryGenerator.lua:1138, :1156) are now orphaned — their only consumer was the post-fetch item rewriting removed here.

Testing

Verified in the running app (macOS native build): both crashes gone, Find best now fills the URL field without listing items.

oat added 2 commits July 25, 2026 19:42
The trade API migrated item mods from plain strings to objects carrying a
description and flags. Commit 2d09769 adapted explicitMods only, so any
item whose runeMods/enchantMods/implicitMods were populated crashed with
"attempt to call method 'gsub' (a nil value)" — escapeGGGString was handed
a table.

Use the same format-agnostic idiom already ported into ImportTab.lua, and
apply it to pseudoMods too, which crashed the same way one line later on
:match. That guard also fixes a pre-existing crash on an empty pseudoMods
array, which previously indexed nil rather than falling back to "0".
Register the generated search so the short shareable link can be built,
then stop. The item listings are no longer fetched, parsed or sorted, so
the row stays on [Find best][url][Price Item] instead of flipping to the
result dropdown. "Price Item" remains available on that URL for when the
items are actually wanted.

The URL is set before the error branch so an empty search still yields a
link to loosen in the browser.

This orphans the Augment/Anoint Behaviour dropdowns in the Find best
dialog: their only consumer was the post-fetch item rewriting removed
here. Left in place rather than wired into "Price Item", which fires on
whatever URL is in the box and would rewrite hand-pasted results based on
a dropdown set during an unrelated search.
@pathanin
pathanin merged commit 9220540 into dev Jul 25, 2026
5 checks passed
@pathanin
pathanin deleted the trader-object-mods-and-url-only branch July 25, 2026 12:44
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