Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(core): update events api routes and config flags, fix events sorting #8369

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(core): add parentId to edit events and update sort events logic
  • Loading branch information
pedrobonamin committed Jan 27, 2025
commit a8d77606280de7c0fb276c610a1e3d83e070ccbc
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import {type EventsObservableValue} from './getInitialFetchEvents'
import {type EditDocumentVersionEvent, type UpdateLiveDocumentEvent} from './types'
import {
addParentToEvents,
sortEvents,
squashLiveEditEvents,
updatePublishedEvents,
updateVersionEvents,
@@ -29,10 +30,7 @@ export function createEventsObservable({
const documentVariantType = getDocumentVariantType(documentId)
return combineLatest([releases$, events$, remoteEdits$, expandedEvents$]).pipe(
map(([releases, {events, nextCursor, loading, error}, remoteEdits, expandedEvents]) => {
const eventsWithRemoteEdits = [...remoteEdits, ...events, ...expandedEvents].sort(
// Sort by timestamp, newest first
(a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp),
)
const eventsWithRemoteEdits = sortEvents({remoteEdits, events, expandedEvents})

if (documentVariantType === 'published') {
return {
Loading
Loading