[fix](trx-frontend-http): show general bookmarks in scheduler bookmark selector

Use the merged bookmarks endpoint instead of separate fetches so general
bookmarks are always visible alongside rig-specific ones.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-24 22:03:00 +01:00
parent d88eb89e16
commit 4b387457af
@@ -106,19 +106,11 @@
} }
function apiGetBookmarks() { function apiGetBookmarks() {
// Fetch general bookmarks and rig-specific bookmarks, then merge. // Fetch merged general + rig-specific bookmarks in a single request.
// Rig-specific entries win on duplicate IDs. var url = currentRigId
var urls = ["/bookmarks"]; ? "/bookmarks?scope=" + encodeURIComponent(currentRigId)
if (currentRigId) urls.push("/bookmarks?scope=" + encodeURIComponent(currentRigId)); : "/bookmarks";
return Promise.all(urls.map(function (u) { return fetch(url).then(function (r) { return r.ok ? r.json() : []; });
return fetch(u).then(function (r) { return r.ok ? r.json() : []; });
})).then(function (results) {
var byId = {};
results.forEach(function (list) {
(Array.isArray(list) ? list : []).forEach(function (bm) { byId[bm.id] = bm; });
});
return Object.values(byId);
});
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------