ItemRack Classic

ItemRack Classic

7M Downloads

Adibag attempts to use ItemRack:RegisterExternalEventListener before Itemrack has initialized

MatthewBerkvens opened this issue ยท 7 comments

commented

Latest versions of both addons on 11/03 (will edit version numbers later)
https://i.imgur.com/wRXUtXr.png
https://i.imgur.com/9EwtkDN.png

I don't know who is responsible for fixing this, created an issue on both repos
AdiAddons/AdiBags#558

commented

@wardz could you have a look please?

commented

Seems like the variable needs to be initialized earlier. You can just move

ItemRack.EventHandlers = {}
ItemRack.ExternalEventHandlers = {}
outside/above of the ItemRack.InitEventHandlers function.

commented
commented

I posted in the AdiBags-ItemRackSets issues already, but I'll put this here in case it helps anyone:
Seems that ItemRack:RegisterExternalEventListener gets loaded later so ItemRack needs to finish loading before it can be used.
Not sure if this is the ideal fix, but I was able to get mine working again by changing a little bit in the Adibags-ItemRackSets.lua file -
On line 35/36 I changed:

ItemRack:RegisterExternalEventListener("ITEMRACK_SET_SAVED", itemRackUpdated)
ItemRack:RegisterExternalEventListener("ITEMRACK_SET_DELETED", itemRackUpdated)

to this:

local IREvents = CreateFrame("Frame", nil)
IREvents:RegisterEvent("ADDON_LOADED")
IREvents:SetScript("OnEvent", function(self, event, addon)
    if (addon == "ItemRack") then
        ItemRack:RegisterExternalEventListener("ITEMRACK_SET_SAVED", itemRackUpdated)
        ItemRack:RegisterExternalEventListener("ITEMRACK_SET_DELETED", itemRackUpdated)
    end
end)
commented

@wardz Thanks for having a look at this

@MatthewBerkvens test this please: https://github.com/Rottenbeer/ItemRack/tree/fix-adibags-race

Works, although the solution posted above seems preferable.

commented

@MatthewBerkvens yeah maybe, but the solution above needs to be taken by the AdiBags dev.

commented

I released 3.54 with the workaround. lmk if adibads pushed a fixed for this and we can revert the workaround.