fix(buffer): live counter
This commit is contained in:
@@ -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} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user