akiomik / akiomik/nosvelte

useConnections() returns an RxJS Observable that violates the Svelte store contract

未關閉
#91 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
TypeScript
星號
29
分支
3
平均合併
3 小時 5 分鐘
30 天內合併 PR
11

描述

`useConnections()` returns a bare RxJS `Observable`
(`src/lib/stores/useConnections.ts:13-32`) and `NostrApp` consumes it as a Svelte
store (`src/lib/components/NostrApp.svelte:49`):

```svelte

```

Svelte's store contract calls `store.subscribe(run, invalidate)`. RxJS 7 still
honours the deprecated positional overload `subscribe(next, error, complete)`, so
**Svelte's `invalidate` callback is registered as the error handler**: an error on
the connection-state stream is delivered to `invalidate` instead of surfacing
anywhere. It also breaks outright under RxJS 8, which removes that overload.

`src/lib/stores/helpers.ts:10-15` contains `fromObservable()`, which exists to
bridge exactly this — but it is dead code: `src/lib/stores/index.ts` does not export
`./helpers.js` and nothing imports it. It also repeats the typing problem described
in #69 (`readable(undefined, ...)` typed as `Readable`).

Determined by code reading.

## Direction

Either bridge through a store-contract-compliant adapter (and fix or remove
`fromObservable` accordingly) or have `useConnections()` return a `Readable`
directly. Whichever is chosen, the two should not both exist with only one of them
wired up.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。