When the player is at a distance just over the stopping distance (weapon range) and then if we tell it to attack the enemy this glitch happens. Usually when the attack starts, the attack animation bar fills up completely then the transition happens to locomotion, then back to attack. But in this case, the animation bar doesnt fill completely and transition to locomotion happens. But I dont know how to fix it.
If the target goes out of range of the fighter component, then what is happening is by design, the StopAttacking trigger makes this happen.