Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

prevent desync state of pagination when deleting annotations

Blue Mouse015d54f261a0
diff --git a/web/app/pages/Project/Settings/Annotations.tsx b/web/app/pages/Project/Settings/Annotations.tsx
index 80c5889f8..47e298644 100644
--- a/web/app/pages/Project/Settings/Annotations.tsx
+++ b/web/app/pages/Project/Settings/Annotations.tsx
@@ -48,6 +48,8 @@ const Annotations = ({ projectId, allowedToManage }: AnnotationsProps) => {
// Sort by date descending (newest first)
const sorted = result.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
setAnnotations(sorted)
+ const totalPages = Math.max(1, Math.ceil(sorted.length / ANNOTATIONS_PER_PAGE))
+ setPage((prev) => Math.min(prev, totalPages))
} catch (reason: any) {
console.error('[ERROR] Failed to load annotations:', reason)
toast.error(typeof reason === 'string' ? reason : t('apiNotifications.somethingWentWrong'))