Skip to content

Unsubscribing from filters #16

@cveering

Description

@cveering

I might be going about this wrong, but I'd like to unsubscribe from filters when the component dismounts, or after some other event, doing something like:

const {
        events,
        unsubscribe,
    } = useNostrEvents({
        filter: {
            authors: [pubkey],
            kinds: [0],
            since: 0
        },
    })

useEffect(() => {
        return () => {
            unsubscribe()
        }
}, [])

Doing this, I get an error stating unsubscribe is not a function even though the type of unsubscribe is () => void. What is the proper way to unsubscribe from a filter?

Really nice work btw... It's been fun playing around with it. :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions