handle reverse ordering on documents page and better handle infinite scroll logic when sort changes