shelley/ui: don't re-sort conversation list on updates

Philip Zeyliger and Shelley created

Prompt: When two conversations are running at the same time, the updates to each other's status (last updated, probably) makes them resort, and it's very distracting, especially if they compete with each other. Let's just not resort them

When two conversations run simultaneously, updates cause them to
compete for position, which is visually distracting. Now we update
conversations in place and only put new conversations at the top.

Co-authored-by: Shelley <shelley@exe.dev>

Change summary

ui/src/App.tsx | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)

Detailed changes

ui/src/App.tsx 🔗

@@ -127,22 +127,13 @@ function App() {
         );
 
         if (existingIndex >= 0) {
-          // Update existing conversation
+          // Update existing conversation in place (don't re-sort to avoid distracting jumps)
           const updated = [...prev];
           updated[existingIndex] = update.conversation!;
-          // Re-sort by updated_at descending
-          updated.sort(
-            (a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),
-          );
           return updated;
         } else {
-          // Add new conversation at the appropriate position
-          const updated = [update.conversation!, ...prev];
-          // Sort by updated_at descending
-          updated.sort(
-            (a, b) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),
-          );
-          return updated;
+          // Add new conversation at the top
+          return [update.conversation!, ...prev];
         }
       });
     } else if (update.type === "delete" && update.conversation_id) {