A live hole silently stops re-emitting when its markup has a conditional on a property (`{m.usage && …}`)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 15/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
调研方向
Start with the repro in the issue: a live GET server component whose markup holds a createMemo over an async source, with a {m.usage && <b>done</b>} conditional inside a .map() row. Compare the streamed hole events with and without the conditional, as the issue's table does. The likely area is how the compiler memoises conditionals whose condition is a property access, and how a memo created inside a re-running hole is tracked. The existing chat example's comment about owner creation is a lead. Done means the hole re-emits, or a dev diagnostic names the expression.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
In a live server component, a markup hole stops re-emitting, silently, when the expression it renders contains a conditional whose condition is a property access. The first render is correct. After that the hole is never sent again, however often its source yields. There is no error, no warning and no diagnostic, on the server or in the browser. Slot arguments in the same component keep updating, which makes it look like a client problem.
What it takes
A live(GET(…)) server function that answers with a component, with a memo over an async iterable read in its markup:
const getThread = liveQuery(
live(
GET(async (id: string) => {
"use server";
return (props: { composer: ComposerSlot }) => {
const view = createMemo(() => db.watchThread(id, signal)); // yields the thread on every write
return (
<article>
<ol>
{view().messages.map(m => (
<li data-id={m.id}>
{m.text.length} {m.usage && <b>done</b>}
</li>
))}
</ol>
<props.composer seen={view().messages.map(m => m.id)} />
</article>
);
};
})
),
"thread"
);
m.usage is undefined until a reply finishes; m.text grows about every 50 ms while one is being written.
What happens
I connected to the live address with curl -N for the length of one reply (about 40 writes to the thread) and counted the events on the stream, changing only the expression inside the <li>:
Inside the <li> |
hole events for the list |
slot-argument events |
|---|---|---|
{m.text.length} |
39 | 43 |
{m.text.length} {m.usage && <b>done</b>} |
0 | 43 |
{m.text.length} {m.usage ? <b>done</b> : null} |
0 | 43 |
const usage = m.usage; then {m.text.length} {usage && <b>done</b>} |
39 | 43 |
In the two failing rows the stream carries the initial html event, with the list registered as a hole and given a digest, and then nothing more for it. In the browser the list stays as first rendered while the composer's seen prop keeps changing.
The same happens when the conditional is inside a plain helper function called from the hole, and with <For> in place of .map(). A condition that is a local identifier (generating && …, where const generating = m.status === "generating") is fine.
What I think is going on
Not established; a reading of the symptoms. The compiler memoises a conditional whose condition it cannot see through (a.b && …, a.b ? … : …). The existing chat example's comments say a live hole "can't mint components as it grows" (an owner-creation latch). A memo created inside a hole on each re-run looks like the same thing, with the difference that nothing reports it and the hole goes quiet instead.
Expected
Either the hole re-emits, or, if creating a memo inside a re-running hole is not supported, a dev diagnostic says so and names the expression. As it stands the markup is silently stale, and the workaround (hoist the property into a local) is not something a reader would guess.
Notes
- Found while rebuilding the chat example as a live server component. It first appeared as
{message.reasoning && <details>…}and{message.usage && <span>…}in a message's markup, and took a bisect of the raw stream to find. - Related, and loud rather than silent: a memo over an async source created per row inside the list (
createMemo(() => db.watchMessage(id))in a row component) fails the document render with<Loading> boundary discovery did not converge after 10001 passes. That one at least says something.
Environment
solidjs/solidnextatdf4e36516, dev build ofsolid-jsand@solidjs/webfrom the workspace@solidjs/router2.0.0-next.38,@solidjs/vite-plugin3.0.0-next.49, Vite 8, dev server- macOS, Node 26; the stream was read with curl, the page in Chromium 152
- 主要语言
- TypeScript
- 星标
- 36.2k
- 派生
- 1.1k
- 平均合并
- 11 小时 19 分钟
- 30 天内合并 PR
- 337
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/solid 的其他 Issue
-
`lazy()`: remounting an already-loaded component renders empty (or the Suspense fallback) since 1.9.14可能已有人在做 @itisrmk 于 8 天前认领。 未关闭1.x
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
2.0.0-rc.18 | `await refresh(memo)` hangs in an action after an optimistic write and a dependency change可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 57/100
维护者通常 1 天内回复
-
[2.0] IMMUTABLE_UPDATE_IN_STORE false positive when an in-place `splice` shifts the next item into the removed index可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
`createRoot`'s dispose function keeps `fn` alive, so `<For>`/`<Index>` rows retain removed list items可能已有人在做 @boombang 于 10 天前认领。 未关闭1.x
难度 4/5 1-2 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
type: bug
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
0️⃣ phase/new
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 1/5 1 小时以内 新手友好度 70/100
microsoft/playwright#43640 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100