akiomik / akiomik/nosvelte

useConnections() emits a growing partial list once per relay on subscribe

未关闭 适合新手
#92 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
29
派生
3
平均合并
3 小时 5 分钟
30 天内合并 PR
11

描述

`useConnections()` seeds the stream with one emission per relay
(`src/lib/stores/useConnections.ts:22-31`):

```ts
const init = relays.map((relay) => { ... });

return rxNostr.createConnectionStateObservable().pipe(
startWith(...init),
scanLatestEach(({ from }) => from)
);
```

`startWith(...init)` spreads N relays as N separate emissions, and
`scanLatestEach` emits after each one. A subscriber therefore receives N values on
subscribe, each a growing partial list — `[a]`, `[a, b]`, `[a, b, c]` — rather than
one value holding the initial state.

`NostrApp` passes this straight to its default slot, so consumers rendering
`{#each connections as connection}` see the list fill in one relay at a time on
every subscribe.

Determined by code reading.

## Direction

Emit the initial state as a single value (`startWith(init)` with an accumulator that
takes a list, or seed the scan directly).

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start in src/lib/stores/useConnections.ts:22-31 and inspect how createConnectionStateObservable is combined with startWith and scanLatestEach. Verify the change by checking that a new subscriber receives one initial value containing all relay states, rather than one growing partial list per relay.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
frontend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
78/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。