eleven / ocho Public

home: unarchived spaces rejoin at the bottom of the list, not the top (#445)

setArchived(off) sent the returning entry to the top of the active "others"
group; it now goes to the bottom (end of the visible list), so a space you
bring back doesn't jump ahead of the ones you kept. Archive positioning
(top of the archive) is unchanged.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Paul Campbell 2218a19b1ab91215f7d5b75d814382b1c667d878 parent b4210ed
2 files changed, +6 −5
  • home/test/serverlist.test.mjs +2 −2
  • home/web/static/serverlist.js +4 −3
diff --git a/home/test/serverlist.test.mjs b/home/test/serverlist.test.mjs
index 27a47b3..1a5da4e 100644
--- a/home/test/serverlist.test.mjs
+++ b/home/test/serverlist.test.mjs
@@ -176,7 +176,7 @@ await test("archiving sends the item to the TOP of the archived group, active ke
assert.deepEqual(urls(archived), ["x", "y"], "x is the top of the archive");
});
-await test("unarchiving sends the item to the TOP of the active others, below Starred", () => {
+await test("unarchiving sends the item to the BOTTOM of the active list", () => {
const servers = [
{ url: "s", starred: true },
{ url: "a" },
@@ -187,7 +187,7 @@ await test("unarchiving sends the item to the TOP of the active others, below St
const entry = next.find((s) => s.url === "z");
assert.equal("archived" in entry, false, "unarchived entry carries no flag");
const { active, archived } = partitionArchived(next);
- assert.deepEqual(urls(active), ["s", "z", "a"], "z is top of others, under Starred s");
+ assert.deepEqual(urls(active), ["s", "a", "z"], "z rejoins at the bottom, after kept spaces");
assert.deepEqual(urls(archived), ["y"], "y stays archived");
});
diff --git a/home/web/static/serverlist.js b/home/web/static/serverlist.js
index 77250a8..02e57ac 100644
--- a/home/web/static/serverlist.js
+++ b/home/web/static/serverlist.js
@@ -32,8 +32,9 @@ export function partitionArchived(servers) {
// `on` AND repositioned to keep the master order active-first-then-archived:
// archive → drop `starred` (an archived space leaves your rail) and send it to
// the TOP of the archived group (most-recently-archived first).
-// unarchive → drop `archived` and send it to the TOP of the active "others"
-// group (below Starred), mirroring how unstar returns an entry.
+// unarchive → drop `archived` and send it to the BOTTOM of the active "others"
+// group (the end of the visible list) — a returning space rejoins
+// at the back, not ahead of the spaces you kept.
// Unknown urls pass through unchanged; the input array/entry is never mutated.
export function setArchived(servers, url, on) {
const list = servers || [];
@@ -48,7 +49,7 @@ export function setArchived(servers, url, on) {
return [...starred, ...others, { ...base, archived: true }, ...archived];
}
const base = (({ archived, ...keep }) => keep)(target); // back to the list
- return [...starred, base, ...others, ...archived];
+ return [...starred, ...others, base, ...archived];
}
// toggleStar returns a NEW servers array with the entry's starred flag flipped