Convert a recency-ordered list of project ids (most-recent FIRST, as returned by
platformScripture.recentlyOpenedProjects.RecentProjects) into a map of projectId → synthetic
lastUsedAt value suitable for feeding into ProjectSelectorProject.customData.
The recently-opened-projects service exposes order without timestamps; this helper synthesizes a
monotonic descending value (higher = more recent). Projects NOT in the list get no entry, so they
fall into the grouping's "Other" bucket per the built-in behavior.
The synthesized ORDER is not consumed by the built-in lastUsed grouping, which reads
lastUsedAt only as a presence flag and leaves each bucket in the component's stable
alphabetical order. What this helper guarantees the grouping is that every listed id gets a
strictly positive, unambiguously-present number. The descending values are still meaningful to a
consumer-defined grouping that chooses to compare them.
The synthesized values are DETERMINISTIC (do not call Date.now()), so calling this at render
time is safe — the returned map has stable content and consumers can memoize on the input list
identity.
DUPLICATE IDS: the FIRST occurrence wins. The input is most-recent-first, so the earliest
position is the most recent use and is the score the id keeps; later occurrences are ignored.
Duplicates are reachable in practice because callers normalize ids on the way in (e.g.
orderedProjectIds.map(normalizeProjectId)), which can collapse two differently-cased raw ids
into one.
Convert a recency-ordered list of project ids (most-recent FIRST, as returned by
platformScripture.recentlyOpenedProjects.RecentProjects) into a map of projectId → syntheticlastUsedAtvalue suitable for feeding intoProjectSelectorProject.customData.The recently-opened-projects service exposes order without timestamps; this helper synthesizes a monotonic descending value (higher = more recent). Projects NOT in the list get no entry, so they fall into the grouping's "Other" bucket per the built-in behavior.
The synthesized ORDER is not consumed by the built-in
lastUsedgrouping, which readslastUsedAtonly as a presence flag and leaves each bucket in the component's stable alphabetical order. What this helper guarantees the grouping is that every listed id gets a strictly positive, unambiguously-present number. The descending values are still meaningful to a consumer-defined grouping that chooses to compare them.The synthesized values are DETERMINISTIC (do not call
Date.now()), so calling this at render time is safe — the returned map has stable content and consumers can memoize on the input list identity.DUPLICATE IDS: the FIRST occurrence wins. The input is most-recent-first, so the earliest position is the most recent use and is the score the id keeps; later occurrences are ignored. Duplicates are reachable in practice because callers normalize ids on the way in (e.g.
orderedProjectIds.map(normalizeProjectId)), which can collapse two differently-cased raw ids into one.