From 313b72f15e8788ba3abcd3e44b5f7785fbc779fe Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Wed, 2 Sep 2026 15:23:30 +0200 Subject: fix(hub): one entry per file in the Search view's Videos grid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A library shared by two groups arrived in the cross-group Search view as two entries per file: every film was two poster cards, every episode was listed twice in the season list under the synopsis. Inside one group this cannot happen — GroupIndex is keyed by blake3 — so the duplication was the Search page's own, from concatenating N independently keyed indexes. source-merge.js folds entries on the content hash and resolves one source per *unit* (a film, a whole show), so a season does not scatter across two nodes. A group hosted by the reader's own node wins; failing that the pick is a hash of the unit key and the reader's id, stable across renders and reloads — a source that changed mid-stream would tear down the connection under a film that is playing — and spread across readers and units. The units come from video-app.js's own groupVideoEntries rather than a second copy of its keys here. Only the Videos view is wired up so far; Music, Photos, failover and the "N sources" badge are phases 5-8 of docs/refactoring-search.md. Every test was checked against the fix removed. That is how the first version of "a unit's files share its source" turned out to prove nothing: with every episode in every group, per-file and per-unit picking give the same answer, so it passed against a per-file implementation. It now uses a unit whose files have unequal sources. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AbwJDbNTkiRUh7HTWEoyss --- packages/meshbay-hub/src/meshbay_hub/static/photos-app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/photos-app.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js b/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js index d63b384..1755392 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js @@ -373,4 +373,9 @@ function PhotosApp({ `; } -export { PhotosApp }; +// groupPhotoAlbums is exported for the Search page, which needs the album a +// photo belongs to in order to merge duplicate sources per album rather than +// per file (docs/refactoring-search.md §5.2). It calls this one, never a copy: +// a second implementation of the album key would keep agreeing with this one +// right up until one of them changed. +export { PhotosApp, groupPhotoAlbums }; -- cgit v1.2.3