pull down to refresh
20 sats \ 2 replies \ @k00b 2 May 2023 \ on: Nostr-Hooks: React hooks for developing Nostr clients. Simple yet intelligent! nostr
Have you considered adding a cache? I think this is the largest hurdle to making performant nostr web apps. I suspect I'd end up rolling my own hooks so that I can have more control over caching.
also nostr-hooks optimizes subscriptions by first checking for available events that match the provided filters, retrieving those events instead of creating a new subscription. If there are no available events that match the provided filters, a new subscription will be created and the new events will be added to the cache.
reply
yeah. nostr-hooks has a built-in cache mechanism since v1.1. each event will be available until there is an active subscription for it. once there was no active sub, it will be cached for a fixed amount of time (~10 sec) and if it doesn't receive a new subscription in that time, it will be removed permanently.
reply