WeakAuras

WeakAuras

206M Downloads

[beta] custom sort keeps sorting states with same index whenever event fires

Causese opened this issue · 1 comments

commented

Describe the bug

it sorts states with same index for some reason instead of doing nothing.
whenever the aura returns true I guess?
if you bump index by 1 of one of the states then it stops.

this affects WAs such as https://wago.io/lgYagHryp , constantly resorting, according to a user report

Do you have an error log of what happened?
no error

To Reproduce

  1. import aura
  2. close options
  3. every time u start moving it will resort and custom sort will print

Screenshots

Which version of WeakAuras are you using?
2.16.0-beta1

Are you on World of Warcraft Classic or Retail?

  • Classic
  • Retail

Was it working in a previous version? If yes, which was the last good one?
2.15.5

Additional Info

!LJvBVPnsq4)lrQsPsHime4isx)qsakurnuwN2M76z8I3127vJxU12HKC68V9BMDT5LeAk9LpCsNibTE3zMD2zEMXplUwUoUKuxsJtTAFA9AZ5zulxYcxcd)dwlujx5s6o(d2UK5sfJRUK6)zMsU0LCzS4HhOkwHNJugNjGPUBCqqkpZTFT2Nzz1SDNgTB1(x605SoUb1oRTl5(kbAFU15T6CERZ70Sz9oDQJR3YLqt8JKQjsrsMl5QE2o9MwTXxjJLkWNSTCTR7A3q)Dt93NHtckKUK6ZXLiu)mHmjvF8YOQmyaSEGirKgzgddnZcJZuIWqUk1yDN1tGdz855bbo3VK7sg0B0K(xpcwx)inxrBG7kpoEil1y30858B5jzeqlXDUKzxDbXzgX5IPGXYXnLSmMEpyCscDbVulTkWgWPXzrBmYefxBeYKEJgHYLNSX1YmoVVmoFrcXC0HSNIYe5PquOEDmEkwqXqX2rccdCCCYzMZrk3xMa(F5XkrMWrdVGksoCPxhBpm5bnOXIWKnzzW70hmiHIN)P8WYmiiASKQHJ5P8z(X00u3564Upo5ICa8vLknR(4ztfpWF8KOW5PzYfePc9)8enM5y6jZFzXBk8mFwQaO4XhzKSWlfKTWlqO4SJ2skfplxLu4rpvPD7tHdtg)urcJFxH3V(QcV57DLI3WtGsT5L1uBdXT0qClne3sdXRFAlDytNs56iGpn2K0JflaKLDRQIfCvZOESqiQt(RCQIx41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K1scVKQ(01dRT5PAeubTVi14KN5cjnlnpgkOXlJ(k3azLHUV(I56lY09YxYMiAe9UJFn2Mc3hDXmgzW9wQeapttBkYGXth(BJTDUy0tV6XwO9kq430VaIgLCl49N1atnU)l
commented

That’s because the sort function is incorrect. Return true only if the children are in the incorrect order.

That is, given regions a, b, then if b should go before a, then return true. If a should go before b, then return false. If it doesn’t matter, then return false.

In your function, you check if the index of one state is <= the index of the other. This will be true if the states are equal, which is consistent with the behavior you are seeing.

So, don’t do that.