[2.0 / next] <Errored> recovery shows a pending memo's answer to an older input beside the new input
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
- 领域
- frontend
调研方向
Start with the two vitest cases in packages/web/test/, which run the same scenario with and without a Loading wrapper inside Errored. Run npx vitest run in packages/web to see the third frame fail with s=1a=10b=21. The fix belongs in how Errored decides it has recovered while memos a and b are still pending on the new input. Done when both tests pass and the frame shows error until a:1 resolves.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
a and b both ask by s. b's first question rejects, so <Errored> shows its fallback. Then s changes and both memos ask again. When b:1 resolves while a:1 is still out, <Errored> recovers and shows s=1a=10b=21. Here a=10 is the answer for s = 0, shown beside s=1. The frame becomes whole only when a:1 lands.
The same happens when the content is wrapped in a <Loading>.
Found by checking every frame of generated ryansolid/reactivescript programs, compiled onto Solid, against F-1.
Your Example Website or App
The vitest spec below (in packages/web/test/), on next @ 77be406ca.
Steps to Reproduce the Bug or Issue
import { render } from "@solidjs/web";
import { createMemo, createSignal, Errored, flush, Loading } from "solid-js";
import { expect, it } from "vitest";
const tick = async () => { for (let i = 0; i < 2; i++) { await new Promise(r => setTimeout(r, 0)); flush(); } };
async function run(boundary: "none" | "loading") {
const flights = new Map<string, { resolve: (v: number) => void; reject: (e: Error) => void }>();
const ask = (key: string) => new Promise<number>((resolve, reject) => flights.set(key, { resolve, reject }));
const [s, setS] = createSignal(0);
const el = document.createElement("div");
const frames: string[] = [];
const dispose = render(() => {
const a = createMemo(() => ask("a:" + s()));
const b = createMemo(() => ask("b:" + s()));
const content = () => (<><p>s={s()}</p><p>a={a()}</p><p>b={b()}</p></>);
return (
<Errored fallback={<p>error</p>}>
{boundary === "loading" ? <Loading fallback={<p>loading</p>}>{content()}</Loading> : content()}
</Errored>
);
}, el);
await tick();
flights.get("a:0")!.resolve(10); await tick();
flights.get("b:0")!.reject(new Error("boom")); await tick(); frames.push(el.textContent!);
setS(1); flush(); await tick(); frames.push(el.textContent!); // a:1 and b:1 asked
flights.get("b:1")!.resolve(21); await tick(); frames.push(el.textContent!); // b recovers; a:1 is still out
flights.get("a:1")!.resolve(11); await tick(); frames.push(el.textContent!);
dispose();
return frames;
}
it("no boundary: <Errored> recovery does not show a pending memo's stale value beside its new input", async () => {
expect(await run("none")).toEqual(["error", "error", "error", "s=1a=11b=21"]);
});
it("inside <Loading>: <Errored> recovery does not show a pending memo's stale value beside its new input", async () => {
expect(await run("loading")).toEqual(["error", "error", "error", "s=1a=11b=21"]);
});
npx vitest run in packages/web. Both tests fail on the third frame, which is s=1a=10b=21 instead of error.
Expected behavior
The recovery waits until every memo in the content can answer the current s, or shows the content's own pending state. It never shows a's answer for an older s beside the new s (F-1, D-39).
Platform
- OS: macOS
- Browser: n/a (jsdom)
- Version: solid-js 2.0.0-rc.20,
next@ 77be406ca
- 主要语言
- TypeScript
- 星标
- 36.2k
- 派生
- 1.1k
- 平均合并
- 11 小时 5 分钟
- 30 天内合并 PR
- 475
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
solidjs/solid 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 28/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 12/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
相似的 Issue
-
Remove unused dependencies可能已有人在做 @alastair-smith 今天认领。 未关闭chore other
难度 2/5 1-3 小时 新手友好度 78/100
alastair-smith/card-games#384 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
code-yeongyu/senpi#5571 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nexu-io/open-design#9262 · 1 条评论 ·
维护者通常 1 天内回复
-
friction
难度 2/5 1-3 小时 新手友好度 72/100
kentcdodds/kody#4753 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 62/100
lingdojo/kana-dojo#33508 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复