Skip to content

Commit 6fed99f

Browse files
authored
trader tool: fix different searches overwriting the last query (#9767)
1 parent dadbe56 commit 6fed99f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/Classes/TradeQuery.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ local TradeQueryClass = newClass("TradeQuery", function(self, itemsTab)
4646
self.allLeagues = {}
4747
-- realm id-text table to pair realm name with API parameter
4848
self.realmIds = {}
49+
-- last query for each row
50+
self.lastQueries = {}
4951

5052
self.tradeQueryRequests = new("TradeQueryRequests")
5153
main.onFrameFuncs["TradeQueryRequests"] = function()
@@ -960,7 +962,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
960962
return
961963
end
962964
context.controls["priceButton"..context.row_idx].label = "Searching..."
963-
self.lastQuery = query
965+
self.lastQueries[row_idx] = query
964966
self.tradeQueryRequests:SearchWithQueryWeightAdjusted(self.pbRealm, self.pbLeague, query,
965967
function(items, errMsg)
966968
if errMsg then
@@ -1041,7 +1043,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
10411043
self:SetNotice(controls.pbNotice, "Error: " .. errMsg)
10421044
else
10431045
self:SetNotice(controls.pbNotice, "")
1044-
self.lastQuery = query
1046+
self.lastQueries[row_idx] = query
10451047
self.resultTbl[row_idx] = items
10461048
self:UpdateControlsWithItems(row_idx)
10471049
end
@@ -1171,7 +1173,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
11711173
if itemResult.whisper then
11721174
Copy(itemResult.whisper)
11731175
else
1174-
local exactQuery = dkjson.decode(self.lastQuery)
1176+
local exactQuery = dkjson.decode(self.lastQueries[row_idx])
11751177
-- use trade sum to get the specific item. both min and max
11761178
-- weight on site uses floats but only shows integer in the api
11771179
-- e.g. weight of 172.3 shows up as 172 in the api

0 commit comments

Comments
 (0)