What you were expecting to happen, and what actually happened:
I expected sorting by Level to display all level 20 before any level 19, somehow Egris level 20 is considered a level 19 in the grouping.
How often does this happen? When did it begin happening?
Was doing a quick sweep of troops to upgrade, and came across this apparent anomaly.
Steps to make it happen again
Assuming it’s not an issue specific to my account, sort by Level and see if a fully upgraded Egris (or something other troop possibly affected by this bug) is grouped among level 19 troops.
I think this might be your culprit. In my experience, if you level a troop, it won’t update its sorting at all during the same game session. I take it Egris started at 19, and stayed there in the sorting even after you pushed it to 20.
My guess is it’ll be fixed if you quit out and return.
It’s not a visual bug, in my experience it can be reproduced with 100% reliability. The filter seems to be operating on a copy of the collection, probably in some indexed format for faster access. It doesn’t get updated while browsing the collection. I guess that would be a fairly time expensive operation, so it only gets set up once, when the game launches. It’s probably not worth spending effort on it, there are way more pressing issues that should be looked at.