fix(buffer): live counter

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-02-11 21:38:26 +01:00
parent 848f475412
commit 3205ea0a31
6 changed files with 56 additions and 18 deletions

View File

@@ -1,12 +1,12 @@
import withSuspense from '@/hocs/with-suspense';
import { getLiveVisitors } from '@openpanel/db';
import { eventBuffer } from '@openpanel/db';
import type { LiveCounterProps } from './live-counter';
import LiveCounter from './live-counter';
async function ServerLiveCounter(props: Omit<LiveCounterProps, 'data'>) {
const count = await getLiveVisitors(props.projectId);
const count = await eventBuffer.getActiveVisitorCount(props.projectId);
return <LiveCounter data={count} {...props} />;
}

View File

@@ -39,7 +39,7 @@ export default function useWS<T>(
onMessage(event) {
try {
const data = getSuperJson<T>(event.data);
if (data) {
if (data !== null && data !== undefined) {
debouncedOnMessage(data);
}
} catch (error) {