From 17e9014052f8637ef8ca6889264581ef15649907 Mon Sep 17 00:00:00 2001 From: Jason Woods Date: Sat, 11 Feb 2023 10:59:54 +0000 Subject: [PATCH] feat: lc-admin file list is now sorted to prevent display jumps on highly active instances Fixes #396 --- lc-admin/views/prospector.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lc-admin/views/prospector.go b/lc-admin/views/prospector.go index f5a36843..efa91633 100644 --- a/lc-admin/views/prospector.go +++ b/lc-admin/views/prospector.go @@ -98,6 +98,18 @@ func (p *Prospector) StartUpdate() { p.updateChan <- err return } + + // Sort the files - they are not sorted at the moment + // TODO: This should be resolved in prospector side + sort.Slice(resp.Files, func(i int, j int) bool { + cmp := strings.Compare(resp.Files[i].Path, resp.Files[j].Path) + if cmp == 0 { + // Equal - compare on ID + return strings.Compare(resp.Files[i].Id, resp.Files[j].Id) < 0 + } + return cmp < 0 + }) + p.updateChan <- &resp }