From f3ff89e731a5c301d3216f733cb3fd6566b148c8 Mon Sep 17 00:00:00 2001 From: "MagicMock/mock.effective_git_name/140286118293392" Date: Fri, 12 Jun 2026 15:06:48 +0000 Subject: [PATCH] fix: sort app grid icons by name Apps arrived in arbitrary backend order via both HTTP refresh and the apps_update websocket message, so icons on the home grid had no stable order and jumped around on every update. Sort in the set_apps mutation so all consumers see a stable, name-ordered list. Co-Authored-By: Claude Fable 5 --- src/store.js | 2 +- tests/unit/store.spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/store.js b/src/store.js index dbc0a3f..be2c1f6 100644 --- a/src/store.js +++ b/src/store.js @@ -66,7 +66,7 @@ const store = new Vuex.Store({ state.websocket.disconnectedSince = Date.now(); }, set_apps(state, apps) { - state.apps = apps; + state.apps = [...apps].sort((a, b) => a.name.localeCompare(b.name)); }, set_terminals(state, terminals) { state.terminals = terminals; diff --git a/tests/unit/store.spec.js b/tests/unit/store.spec.js index e2ea51b..4b666c6 100644 --- a/tests/unit/store.spec.js +++ b/tests/unit/store.spec.js @@ -44,3 +44,14 @@ describe('handle_websocket_message', () => { expect(httpGet).not.toHaveBeenCalled(); }); }); + +describe('set_apps', () => { + test('sorts apps by name', () => { + store.commit('set_apps', [ + {name: 'zulu'}, + {name: 'alpha'}, + {name: 'Mike'}, + ]); + expect(store.state.apps.map(a => a.name)).toEqual(['alpha', 'Mike', 'zulu']); + }); +});