Skip to content

Commit

Permalink
Update trade query close function to only clear item slot controls in…
Browse files Browse the repository at this point in the history
…stead of all controls (#7338)
  • Loading branch information
Peechey authored Mar 9, 2024
1 parent 520344c commit 68aa2a1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Classes/TradeQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,21 @@ Highest Weight - Displays the order retrieved from trade]]
return scrollBarShown
end

local function wipeItemControls()
for index, _ in pairs(self.controls) do
if index:match("%d") then
self.controls[index] = nil
end
end
end
self.controls.fullPrice = new("LabelControl", {"BOTTOM", nil, "BOTTOM"}, 0, -row_height - pane_margins_vertical - row_vertical_padding, pane_width - 2 * pane_margins_horizontal, row_height, "")
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
self.controls.close = new("ButtonControl", {"BOTTOM", nil, "BOTTOM"}, 0, -pane_margins_vertical, 90, row_height, "Done", function()
GlobalCache.useFullDPS = self.storedGlobalCacheDPSView
main:ClosePopup()
-- there's a case where if you have a socket(s) allocated, open TradeQuery, close it, dealloc, then open TradeQuery again
-- the deallocated socket controls were still showing, so this will give us a clean slate of controls every time
wipeTable(self.controls)
-- the deallocated socket controls were still showing, so this will remove all dynamically created controls from items
wipeItemControls()
end)

self.controls.updateCurrencyConversion = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOMLEFT"}, pane_margins_horizontal, -pane_margins_vertical, 240, row_height, "Get Currency Conversion Rates", function()
Expand Down

0 comments on commit 68aa2a1

Please sign in to comment.