@ai-matrx/associations 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1415,8 +1415,11 @@ async function loadRecents(store, tokens) {
1415
1415
  if (!res.ok) return [];
1416
1416
  const tokenSet = new Set(tokens);
1417
1417
  const rows = res.data.items.filter(
1418
- (i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && i.lastViewedAt
1419
- ).sort((a, b) => (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "")).slice(0, RECENTS_LIMIT);
1418
+ (i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && (i.isFavorite || i.lastViewedAt)
1419
+ ).sort((a, b) => {
1420
+ if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;
1421
+ return (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "");
1422
+ }).slice(0, RECENTS_LIMIT);
1420
1423
  if (rows.length === 0) return [];
1421
1424
  const byToken = /* @__PURE__ */ new Map();
1422
1425
  for (const r of rows) {