Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix: pagination bug #296

Carl-Gerhard Lindesvärd7f85b2ac0a15
diff --git a/packages/db/src/services/event.service.ts b/packages/db/src/services/event.service.ts
index fc1667b07..94df14770 100644
--- a/packages/db/src/services/event.service.ts
+++ b/packages/db/src/services/event.service.ts
@@ -477,7 +477,7 @@ export async function getEventList(options: GetEventListOptions) {
sb.where.cursor = `created_at < ${sqlstring.escape(formatClickhouseDate(cursor))}`;
}
- if (!cursor) {
+ if (!cursor && !(startDate && endDate)) {
sb.where.cursorWindow = `created_at >= toDateTime64(${sqlstring.escape(formatClickhouseDate(new Date()))}, 3) - INTERVAL ${safeDateIntervalInDays} DAY`;
}
@@ -628,7 +628,7 @@ export async function getEventList(options: GetEventListOptions) {
}
}
- sb.orderBy.created_at = 'created_at DESC';
+ sb.orderBy.created_at = 'created_at DESC, id ASC';
if (custom) {
custom(sb);