惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
博客园_首页
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
小众软件
小众软件
博客园 - 司徒正美
雷峰网
雷峰网
T
Tailwind CSS Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
罗磊的独立博客
量子位
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix #89466: [Bug]: Control UI chat input text not cleared...
zhangguiping · 2026-06-22 · via Recent Commits to openclaw:main

@@ -1973,6 +1973,212 @@ describe("chat slash menu accessibility", () => {

19731973

expect(container.querySelector<HTMLTextAreaElement>("textarea")?.value).toBe("");

19741974

});

197519751976+

it("ignores a stale native InputEvent replay after send clears the host draft", () => {

1977+

let draft = "";

1978+

const container = document.createElement("div");

1979+

const onDraftChange = vi.fn((next: string) => {

1980+

draft = next;

1981+

});

1982+

const onSend = vi.fn(() => {

1983+

draft = "";

1984+

});

1985+

const renderWithDraft = () => {

1986+

render(

1987+

renderChat(createChatProps({ draft, getDraft: () => draft, onDraftChange, onSend })),

1988+

container,

1989+

);

1990+

};

1991+1992+

renderWithDraft();

1993+

inputDraft(container, "submitted message");

1994+

container.querySelector<HTMLButtonElement>(".chat-send-btn")!.click();

1995+1996+

const textarea = container.querySelector<HTMLTextAreaElement>("textarea");

1997+

expect(textarea?.value).toBe("");

1998+1999+

textarea!.value = "submitted message";

2000+

textarea!.dispatchEvent(

2001+

new InputEvent("input", {

2002+

bubbles: true,

2003+

data: "submitted message",

2004+

inputType: "insertText",

2005+

}),

2006+

);

2007+2008+

expect(textarea?.value).toBe("");

2009+

expect(onDraftChange).toHaveBeenCalledTimes(1);

2010+

});

2011+2012+

it("keeps a new same-session draft when a delayed stale replay arrives", () => {

2013+

let draft = "";

2014+

const container = document.createElement("div");

2015+

const onDraftChange = vi.fn((next: string) => {

2016+

draft = next;

2017+

});

2018+

const onSend = vi.fn(() => {

2019+

draft = "";

2020+

});

2021+

const renderWithDraft = () => {

2022+

render(

2023+

renderChat(createChatProps({ draft, getDraft: () => draft, onDraftChange, onSend })),

2024+

container,

2025+

);

2026+

};

2027+2028+

renderWithDraft();

2029+

inputDraft(container, "submitted message");

2030+

container.querySelector<HTMLButtonElement>(".chat-send-btn")!.click();

2031+2032+

const textarea = container.querySelector<HTMLTextAreaElement>("textarea");

2033+

expect(textarea?.value).toBe("");

2034+2035+

textarea!.dispatchEvent(

2036+

new InputEvent("beforeinput", {

2037+

bubbles: true,

2038+

data: "new draft",

2039+

inputType: "insertText",

2040+

}),

2041+

);

2042+

textarea!.value = "new draft";

2043+

textarea!.dispatchEvent(

2044+

new InputEvent("input", {

2045+

bubbles: true,

2046+

data: "new draft",

2047+

inputType: "insertText",

2048+

}),

2049+

);

2050+

expect(textarea?.value).toBe("new draft");

2051+2052+

textarea!.value = "submitted message";

2053+

textarea!.dispatchEvent(

2054+

new InputEvent("input", {

2055+

bubbles: true,

2056+

data: "submitted message",

2057+

inputType: "insertText",

2058+

}),

2059+

);

2060+2061+

expect(textarea?.value).toBe("new draft");

2062+

expect(onDraftChange).toHaveBeenCalledTimes(1);

2063+

});

2064+2065+

it("does not apply a stale submitted draft replay to another session", () => {

2066+

const drafts: Record<string, string> = {

2067+

"stale-replay-a": "",

2068+

"stale-replay-b": "",

2069+

};

2070+

const onDraftChange = vi.fn((sessionKey: string, next: string) => {

2071+

drafts[sessionKey] = next;

2072+

});

2073+

const container = document.createElement("div");

2074+

const renderSession = (sessionKey: string) => {

2075+

render(

2076+

renderChat(

2077+

createChatProps({

2078+

currentAgentId: "stale-replay-agent",

2079+

draft: drafts[sessionKey],

2080+

getDraft: () => drafts[sessionKey],

2081+

onDraftChange: (next) => onDraftChange(sessionKey, next),

2082+

onSend: () => {

2083+

drafts[sessionKey] = "";

2084+

},

2085+

sessionKey,

2086+

}),

2087+

),

2088+

container,

2089+

);

2090+

};

2091+2092+

renderSession("stale-replay-a");

2093+

inputDraft(container, "submitted message");

2094+

container.querySelector<HTMLButtonElement>(".chat-send-btn")!.click();

2095+

expect(container.querySelector<HTMLTextAreaElement>("textarea")?.value).toBe("");

2096+2097+

renderSession("stale-replay-b");

2098+

const textarea = container.querySelector<HTMLTextAreaElement>("textarea");

2099+

expect(textarea?.value).toBe("");

2100+2101+

textarea!.value = "submitted message";

2102+

textarea!.dispatchEvent(

2103+

new InputEvent("input", {

2104+

bubbles: true,

2105+

data: "submitted message",

2106+

inputType: "insertText",

2107+

}),

2108+

);

2109+2110+

expect(textarea?.value).toBe("");

2111+

expect(drafts["stale-replay-b"]).toBe("");

2112+

expect(onDraftChange).toHaveBeenCalledTimes(1);

2113+

});

2114+2115+

it("keeps an intervening session draft when a delayed stale replay arrives", () => {

2116+

const drafts: Record<string, string> = {

2117+

"delayed-replay-a": "",

2118+

"delayed-replay-b": "",

2119+

};

2120+

const onDraftChange = vi.fn((sessionKey: string, next: string) => {

2121+

drafts[sessionKey] = next;

2122+

});

2123+

const container = document.createElement("div");

2124+

const renderSession = (sessionKey: string) => {

2125+

render(

2126+

renderChat(

2127+

createChatProps({

2128+

currentAgentId: "delayed-replay-agent",

2129+

draft: drafts[sessionKey],

2130+

getDraft: () => drafts[sessionKey],

2131+

onDraftChange: (next) => onDraftChange(sessionKey, next),

2132+

onSend: () => {

2133+

drafts[sessionKey] = "";

2134+

},

2135+

sessionKey,

2136+

}),

2137+

),

2138+

container,

2139+

);

2140+

};

2141+2142+

renderSession("delayed-replay-a");

2143+

inputDraft(container, "submitted message");

2144+

container.querySelector<HTMLButtonElement>(".chat-send-btn")!.click();

2145+

expect(container.querySelector<HTMLTextAreaElement>("textarea")?.value).toBe("");

2146+2147+

renderSession("delayed-replay-b");

2148+

const textarea = container.querySelector<HTMLTextAreaElement>("textarea");

2149+

expect(textarea?.value).toBe("");

2150+2151+

textarea!.dispatchEvent(

2152+

new InputEvent("beforeinput", {

2153+

bubbles: true,

2154+

data: "session b draft",

2155+

inputType: "insertText",

2156+

}),

2157+

);

2158+

textarea!.value = "session b draft";

2159+

textarea!.dispatchEvent(

2160+

new InputEvent("input", {

2161+

bubbles: true,

2162+

data: "session b draft",

2163+

inputType: "insertText",

2164+

}),

2165+

);

2166+

expect(textarea?.value).toBe("session b draft");

2167+2168+

textarea!.value = "submitted message";

2169+

textarea!.dispatchEvent(

2170+

new InputEvent("input", {

2171+

bubbles: true,

2172+

data: "submitted message",

2173+

inputType: "insertText",

2174+

}),

2175+

);

2176+2177+

expect(textarea?.value).toBe("session b draft");

2178+

expect(drafts["delayed-replay-b"]).toBe("");

2179+

expect(onDraftChange).toHaveBeenCalledTimes(1);

2180+

});

2181+19762182

it("commits local draft input before Enter sends", () => {

19772183

const onDraftChange = vi.fn();

19782184

const onSend = vi.fn();