I'm struggling to make createSubscription work. I'm always facing the same Issue. I tried setting the types to the NDKFilter and NDKKinds and got the same result. Is there something I missed?
// src/hooks/useSingleCalendarEvent.ts
import { useEffect } from 'react';
import { useSubscription } from 'nostr-hooks';
export const useSingleCalendarEvent = ({ calendarId }: { calendarId: string | undefined }) => {
const subId = `calendar-${calendarId}`;
const { events, isLoading, createSubscription } = useSubscription(subId);
useEffect(() => {
if (!calendarId) return;
const filters = [{
authors: ["89b5267c2f18e7d76a7c829399d5d0da923b687d53ea26a6fd35a770f99ae01"],
kinds: [31924],
limit: 1,
}];
createSubscription(filters);
}, [calendarId, createSubscription, isLoading, events, subId]);
return { events, isLoading };
};
// src/components/NostrEventOverview/CalendarOverview.tsx
import * as React from 'react';
import Card from '@mui/material/Card';
import CardActions from '@mui/material/CardActions';
import CardContent from '@mui/material/CardContent';
import CardMedia from '@mui/material/CardMedia';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import { useSingleCalendarEvent } from '@/hooks/useSingleCalendarEvent';
import { useEffect } from 'react';
export default function CalendarOverview(calendarId: string | undefined) {
const { events, isLoading } = useSingleCalendarEvent(calendarId);
I'm struggling to make createSubscription work. I'm always facing the same Issue. I tried setting the types to the NDKFilter and NDKKinds and got the same result. Is there something I missed?