typescript fixes, replayer close error, show page toggle fix.

This commit is contained in:
Francis Cao committed 2026-06-17 10:02:12 -07:00
1 parent 10dced1049
commit f3ce0e64ca
15 files changed
+67 -28

No files matched your search

@@ -23,7 +23,7 @@ export function TestConsolePage({ websiteId }: { websiteId: string }) {
test: 'test-data',
boolean: true,
booleanError: 'true',
time: new Date(),
time: new Date().toISOString(),
user: `user${Math.round(Math.random() * 10)}`,
number: 1,
number2: Math.random() * 100,
@@ -87,7 +87,7 @@ export function TestConsolePage({ websiteId }: { websiteId: string }) {
test: 'test-data',
boolean: true,
booleanError: 'true',
time: new Date(),
time: new Date().toISOString(),
time2: new Date().toISOString(),
nested: {
test: 'test-data',
-1
View File
@@ -10,7 +10,6 @@ export function LinkEditButton({ linkId }: { linkId: string }) {
return (
<LinkButton
href={renderUrl(`/links/${linkId}/edit`, false)}
title={t(labels.edit)}
aria-label={t(labels.edit)}
variant="quiet"
>
@@ -10,7 +10,6 @@ export function PixelEditButton({ pixelId }: { pixelId: string }) {
return (
<LinkButton
href={renderUrl(`/pixels/${pixelId}/edit`, false)}
title={t(labels.edit)}
aria-label={t(labels.edit)}
variant="quiet"
>
@@ -269,8 +269,8 @@ function ClickHeatmapView({
const hasSnapshot = Boolean(snapshot);
useEffect(() => {
setSnapshotReady(!(showPage && hasSnapshot));
}, [hasSnapshot, showPage, snapshot?.id]);
setSnapshotReady(!hasSnapshot);
}, [hasSnapshot, snapshot?.id]);
const overlayGutter = Math.max(48, Math.round((viewport?.width ?? 1920) * 0.04));
const maxPointX = visible.reduce((max, point) => Math.max(max, point.pageX), 0);
const maxPointY = visible.reduce((max, point) => Math.max(max, point.pageY), 0);
@@ -425,8 +425,8 @@ function ScrollHeatmapView({
const hasSnapshot = Boolean(snapshot);
useEffect(() => {
setSnapshotReady(!(showPage && hasSnapshot));
}, [hasSnapshot, showPage, snapshot?.id]);
setSnapshotReady(!hasSnapshot);
}, [hasSnapshot, snapshot?.id]);
const {
buckets = [],
totalSessions = 0,
@@ -1,4 +1,4 @@
import thenby from 'thenby';
import { firstBy } from 'thenby';
import { useMessages, useWebsite } from '@/components/hooks';
import { ListTable } from '@/components/metrics/ListTable';
import { percentFilter } from '@/lib/filters';
@@ -26,7 +26,7 @@ export function RealtimePaths({ data }: { data: any }) {
y: urls[key],
};
})
.sort(thenby.firstBy('y', -1))
.sort(firstBy('y', -1))
.slice(0, limit),
);
@@ -1,7 +1,7 @@
import thenby from 'thenby';
import { useMessages, useWebsite } from '@/components/hooks';
import { ListTable } from '@/components/metrics/ListTable';
import { percentFilter } from '@/lib/filters';
import { firstBy } from 'thenby';
export function RealtimeReferrers({ data }: { data: any }) {
const website = useWebsite();
@@ -26,7 +26,7 @@ export function RealtimeReferrers({ data }: { data: any }) {
y: referrers[key],
};
})
.sort(thenby.firstBy('y', -1))
.sort(firstBy('y', -1))
.slice(0, limit),
);
@@ -8,6 +8,21 @@ import 'rrweb-player/dist/style.css';
const DEFAULT_REPLAY_ASPECT_RATIO = 9 / 16;
function destroyReplayPlayer(player: { $destroy?: () => void } | null) {
if (!player) {
return;
}
try {
player.$destroy?.();
} catch (error) {
// rrweb-player alpha teardown can throw after it loses its inner replayer instance.
if (!(error instanceof TypeError) || !error.message.includes('pause is not a function')) {
throw error;
}
}
}
export function ReplayPlayer({ events }: { events: any[] }) {
const playerRootRef = useRef<HTMLDivElement>(null);
const playerRef = useRef<any>(null);
@@ -34,7 +49,7 @@ export function ReplayPlayer({ events }: { events: any[] }) {
setPlayerError(false);
if (playerRef.current) {
playerRef.current.$destroy?.();
destroyReplayPlayer(playerRef.current);
playerRef.current = null;
}
@@ -89,7 +104,7 @@ export function ReplayPlayer({ events }: { events: any[] }) {
cancelled = true;
if (playerRef.current) {
playerRef.current.$destroy?.();
destroyReplayPlayer(playerRef.current);
playerRef.current = null;
}
+1 -1
View File
@@ -20,7 +20,7 @@ vi.mock('@/lib/response', () => ({
ok: () => new Response(null, { status: 200 }),
}));
const redisMock = redis as {
const redisMock = redis as unknown as {
enabled: boolean;
client: {
del: ReturnType<typeof vi.fn>;