akiomik / akiomik/nosvelte

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

Đang mở
#91 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
29
Fork
3
Merge trung bình
3 giờ 5 phút
Pull request đã merge (30 ngày)
11

Mô tả

`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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Inspect src/lib/stores/useConnections.ts:13-32, src/lib/components/NostrApp.svelte:49, and src/lib/stores/helpers.ts:10-15, then check the exports in src/lib/stores/index.ts. Choose one store-contract-compliant approach, ensure the helper and useConnections() are not redundant, and verify that connection-stream errors are handled correctly under the Svelte contract.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.