Hooks throw RxNostrAlreadyDisposedError after NostrApp is destroyed
- Dominant language
- TypeScript
- Stars
- 29
- Forks
- 3
- Avg merge
- 3h 5m
- Merged PRs (30d)
- 11
Description
`NostrApp` disposes its `rxNostr` on destroy
(`src/lib/components/NostrApp.svelte:38-40`) but never clears the module-level
`app` store, so the disposed instance stays published.
`useReq()`'s very first statement reads `rxNostr.getDefaultRelays()`
(`src/lib/stores/useReq.ts:25`), which throws `RxNostrAlreadyDisposedError` on a
disposed instance. Verified on `main` (609f8ed).
Any hook invocation after the provider is torn down is therefore an uncaught throw
rather than a graceful degradation. Reachable via a route change that leaves a
child mounted for a tick, an `{#if}` toggle around ``, or SSR where
`onDestroy` runs at the end of render.
## Direction
Clear the published instance on destroy, and have the hooks treat "no usable
rxNostr" as a state rather than letting the throw escape.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the destroy handling in src/lib/components/NostrApp.svelte:38-40 and the first statement of src/lib/stores/useReq.ts:25. Trace how the module-level app store is published and how hooks access it, then exercise teardown during route changes, conditional rendering, or SSR. Done means post-destroy hook calls no longer throw RxNostrAlreadyDisposedError and the disposed instance is no longer published.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100