@emeryld/rrroutes-export 1.0.16 → 1.0.17
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.
package/package.json
CHANGED
|
@@ -1669,7 +1669,7 @@
|
|
|
1669
1669
|
routeKey,
|
|
1670
1670
|
event,
|
|
1671
1671
|
commit: commitBySha.get(event.commitSha),
|
|
1672
|
-
commitIndex: commitOrder.get(event.commitSha) ??
|
|
1672
|
+
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1673
1673
|
eventIndex: sequence++,
|
|
1674
1674
|
})
|
|
1675
1675
|
})
|
|
@@ -1683,15 +1683,15 @@
|
|
|
1683
1683
|
displayName: event.displayName || sourceObjectId,
|
|
1684
1684
|
event,
|
|
1685
1685
|
commit: commitBySha.get(event.commitSha),
|
|
1686
|
-
commitIndex: commitOrder.get(event.commitSha) ??
|
|
1686
|
+
commitIndex: commitOrder.get(event.commitSha) ?? -1,
|
|
1687
1687
|
eventIndex: sequence++,
|
|
1688
1688
|
})
|
|
1689
1689
|
})
|
|
1690
1690
|
})
|
|
1691
1691
|
|
|
1692
1692
|
rows.sort((a, b) => {
|
|
1693
|
-
if (a.commitIndex !== b.commitIndex) return
|
|
1694
|
-
return
|
|
1693
|
+
if (a.commitIndex !== b.commitIndex) return b.commitIndex - a.commitIndex
|
|
1694
|
+
return b.eventIndex - a.eventIndex
|
|
1695
1695
|
})
|
|
1696
1696
|
|
|
1697
1697
|
return rows
|
|
@@ -1704,13 +1704,34 @@
|
|
|
1704
1704
|
return buildChronologicalEvents(payload)
|
|
1705
1705
|
}
|
|
1706
1706
|
if (tabId === VIEW_IDS.changelogSource) {
|
|
1707
|
+
const commitOrder = new Map((payload.commits || []).map((commit, index) => [commit.sha, index]))
|
|
1708
|
+
const sortEventsNewestFirst = (events) =>
|
|
1709
|
+
[...(events || [])].sort((a, b) => {
|
|
1710
|
+
const aIndex = commitOrder.get(a?.commitSha) ?? -1
|
|
1711
|
+
const bIndex = commitOrder.get(b?.commitSha) ?? -1
|
|
1712
|
+
if (aIndex !== bIndex) return bIndex - aIndex
|
|
1713
|
+
return String(b?.commitSha || '').localeCompare(String(a?.commitSha || ''))
|
|
1714
|
+
})
|
|
1715
|
+
|
|
1707
1716
|
return Object.entries(payload.bySourceObject || {})
|
|
1708
|
-
.
|
|
1709
|
-
|
|
1717
|
+
.map(([sourceId, events]) => {
|
|
1718
|
+
const sortedEvents = sortEventsNewestFirst(events)
|
|
1719
|
+
const latestCommitIndex = sortedEvents.length
|
|
1720
|
+
? commitOrder.get(sortedEvents[0]?.commitSha) ?? -1
|
|
1721
|
+
: -1
|
|
1722
|
+
return {
|
|
1710
1723
|
sourceId,
|
|
1711
|
-
events,
|
|
1712
|
-
displayName:
|
|
1713
|
-
|
|
1724
|
+
events: sortedEvents,
|
|
1725
|
+
displayName: sortedEvents[0]?.displayName || sourceId,
|
|
1726
|
+
latestCommitIndex,
|
|
1727
|
+
}
|
|
1728
|
+
})
|
|
1729
|
+
.sort((a, b) => {
|
|
1730
|
+
if (a.latestCommitIndex !== b.latestCommitIndex) {
|
|
1731
|
+
return b.latestCommitIndex - a.latestCommitIndex
|
|
1732
|
+
}
|
|
1733
|
+
return a.displayName.localeCompare(b.displayName)
|
|
1734
|
+
})
|
|
1714
1735
|
}
|
|
1715
1736
|
return []
|
|
1716
1737
|
}
|
|
@@ -2075,7 +2096,6 @@
|
|
|
2075
2096
|
function applyLoadedPayload(payload) {
|
|
2076
2097
|
state.viewerMode = resolveViewerMode(payload)
|
|
2077
2098
|
applyViewerModeMeta()
|
|
2078
|
-
state.payload = payload
|
|
2079
2099
|
state.availableTabs = new Set()
|
|
2080
2100
|
state.leavesPayload = null
|
|
2081
2101
|
state.changelogPayload = null
|
|
@@ -2090,6 +2110,8 @@
|
|
|
2090
2110
|
state.leavesPayload = payload
|
|
2091
2111
|
}
|
|
2092
2112
|
|
|
2113
|
+
state.payload = state.leavesPayload || payload
|
|
2114
|
+
|
|
2093
2115
|
if (state.leavesPayload) {
|
|
2094
2116
|
state.availableTabs.add(VIEW_IDS.leaves)
|
|
2095
2117
|
state.leaves = state.leavesPayload.leaves || []
|