← back to Wallco Ai
/designs: fix 'newest' sort — was returning oldest first
14ea612a7e363ea765a715103e43aa619a59e0f1 · 2026-05-13 10:10:21 -0700 · SteveStudio2
sortDesigns('newest') was 'd.sort(tie(() => 0))' which is a stable
no-op against the snapshot's load order. designs.json is written in id
ASC, so 'newest' was actually returning OLDEST first. Every drunk-
animal + stoned-animal sat 46 pages deep instead of the front page.
- Now: d.sort((a,b) => b.id - a.id) — strict id DESC
- Also removed the has-room tie-break for newest — promoting designs
with room_mockups was sandbagging the actually-latest (those don't
have rooms yet). Other sorts still use the room tie-break.
Verified: first 8 cards now 3002, 3001, 3000, 2999, 2998, 2997, 2996, 2995.
Files touched
Diff
commit 14ea612a7e363ea765a715103e43aa619a59e0f1
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Wed May 13 10:10:21 2026 -0700
/designs: fix 'newest' sort — was returning oldest first
sortDesigns('newest') was 'd.sort(tie(() => 0))' which is a stable
no-op against the snapshot's load order. designs.json is written in id
ASC, so 'newest' was actually returning OLDEST first. Every drunk-
animal + stoned-animal sat 46 pages deep instead of the front page.
- Now: d.sort((a,b) => b.id - a.id) — strict id DESC
- Also removed the has-room tie-break for newest — promoting designs
with room_mockups was sandbagging the actually-latest (those don't
have rooms yet). Other sorts still use the room tie-break.
Verified: first 8 cards now 3002, 3001, 3000, 2999, 2998, 2997, 2996, 2995.
---
server.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/server.js b/server.js
index f18d221..51b9c59 100644
--- a/server.js
+++ b/server.js
@@ -609,7 +609,11 @@ function sortDesigns(designs, sort) {
const bA = Math.floor(ha/30), bB = Math.floor(hb/30);
return bA !== bB ? bA-bB : la-lb;
}));
- default: return d.sort(tie(() => 0)); // newest = has-room first then DB order
+ // newest = strict highest id first. NO has-room tie-break — when a
+ // visitor explicitly asks for newest, hide-no-rooms-promote-rooms would
+ // sandbag the actual latest designs (the drunk-animals + stoned-animals
+ // currently generating don't have room_mockups yet).
+ default: return d.sort((a,b) => (b.id||0) - (a.id||0));
}
}
← 9232294 /designs admin review-card: hide overlay on load, fade in on
·
back to Wallco Ai
·
mural-animals: Iksel/de Gournay/Mural Sources refined collec 9b791a3 →