[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:
@@ -106,19 +106,11 @@
|
||||
}
|
||||
|
||||
function apiGetBookmarks() {
|
||||
// Fetch general bookmarks and rig-specific bookmarks, then merge.
|
||||
// Rig-specific entries win on duplicate IDs.
|
||||
var urls = ["/bookmarks"];
|
||||
if (currentRigId) urls.push("/bookmarks?scope=" + encodeURIComponent(currentRigId));
|
||||
return Promise.all(urls.map(function (u) {
|
||||
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);
|
||||
});
|
||||
// Fetch merged general + rig-specific bookmarks in a single request.
|
||||
var url = currentRigId
|
||||
? "/bookmarks?scope=" + encodeURIComponent(currentRigId)
|
||||
: "/bookmarks";
|
||||
return fetch(url).then(function (r) { return r.ok ? r.json() : []; });
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user