[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() {
|
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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user