Describe the bug
Sometimes selecting a token and using Arrange -> Bring to Front/Send to Back requires a second attempt before it works.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should only take one action to bring token forwards/backwards.
Screenshots
Positioning of tokens for ease of selection.

MapTool Info
Desktop (please complete the following information):
Can't replicate this with 1.5.4 RC1 and the develop branch.
Curious. It's a 100% reproducible for me on two different PCs.
Ok I experienced the bug. But I'm having trouble reproducing it, most of the time it works just fine.
With existing campaign files with lots of token, some tokens always work while others behave as noted above or sometimes take 3 or more attempts. The only way I found to reliably produce it for me was the steps noted above on a clean campaign.
I could not reproduce with versions prior to 1.5.2.
Pretty sure my PR #662 fixes it. @Phergus, could you test it? You seem to trigger the bug more reliably than I can.
Will do.
Tested and working as expected.
Thanks, @Phergus !
The issue was that getSmallestZOrder and getLargestZOrder rely on an correctly ordered tokenOrderedList (the two functions respectively return the first and last entry of that list).
That list was not reordered on the server after the sendToBack / bringToFront. That is ow fixed.