🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(page-editor): drop document-like analytics so pages open in DocumentModal (#19099)
Rdmclin2359151d88562
diff --git a/src/features/PageEditor/DocumentLikes/index.tsx b/src/features/PageEditor/DocumentLikes/index.tsxindex 1ca0b27495a..816125998d8 100644--- a/src/features/PageEditor/DocumentLikes/index.tsx+++ b/src/features/PageEditor/DocumentLikes/index.tsx@@ -1,7 +1,6 @@'use client';import type { DocumentLikeSummary } from '@lobechat/types';-import { useAnalytics } from '@lobehub/analytics/react';import { Flexbox } from '@lobehub/ui';import { Avatar, Skeleton, Text, toast, Tooltip } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';@@ -120,7 +119,6 @@ const DocumentLikes = memo<{ documentId: string }>(({ documentId }) => {const { t } = useTranslation('file');const workspaceId = useActiveWorkspaceId();const user = useUserStore(userProfileSelectors.userProfile);- const { analytics } = useAnalytics();const { data, error, isLoading, mutate } = useDocumentLikeSummary(workspaceId, documentId);// Last user-intended liked state; null when the UI matches the server.const targetRef = useRef<boolean | null>(null);@@ -141,32 +139,11 @@ const DocumentLikes = memo<{ documentId: string }>(({ documentId }) => {summary = sent? await documentLikeService.like(documentId): await documentLikeService.unlike(documentId);- // Bounded dimensions only — no document id, which would create an- // unbounded high-cardinality analytics field.- analytics?.track({- name: 'document_like_toggle',- properties: {- action: sent ? 'like' : 'unlike',- outcome: 'success',- spm: 'page_editor.likes.toggle',- },- });}targetRef.current = null;if (summary) await mutate(summary, { revalidate: false });} catch (toggleError) {console.error('Failed to toggle document like', toggleError);- // Attribute the failure to the request that actually failed (`sent`),- // not the latest queued intent, which may already point the other way.- if (sent !== undefined)- analytics?.track({- name: 'document_like_toggle',- properties: {- action: sent ? 'like' : 'unlike',- outcome: 'failure',- spm: 'page_editor.likes.toggle',- },- });targetRef.current = null;toast.error(t('pageEditor.likes.failed'));// Recover the truth from the server rather than guessing a rollback@@ -178,7 +155,7 @@ const DocumentLikes = memo<{ documentId: string }>(({ documentId }) => {} finally {inFlightRef.current = false;}- }, [analytics, documentId, mutate, t]);+ }, [documentId, mutate, t]);const toggle = useCallback(() => {if (!data) return;