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

推荐订阅源

The GitHub Blog
The GitHub Blog
I
InfoQ
U
Unit 42
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
月光博客
月光博客
D
Docker
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
V
Visual Studio Blog
博客园 - 聂微东
A
About on SuperTechFans
腾讯CDC
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
博客园 - 【当耐特】
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence

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
test(ui): clean up navigation teardown (#76625) · opencla...
amknight · 2026-05-03 · via Recent Commits to openclaw:main

@@ -41,9 +41,69 @@ function createMatchMediaMock(width: number) {

4141

};

4242

});

4343

}

44+45+

const mountedApps = new Set<OpenClawApp>();

46+47+

function collectMountedApps() {

48+

return new Set<OpenClawApp>([

49+

...mountedApps,

50+

...document.querySelectorAll<OpenClawApp>("openclaw-app"),

51+

]);

52+

}

53+54+

function nextMicrotask() {

55+

return Promise.resolve();

56+

}

57+58+

function nextTimer() {

59+

return new Promise<void>((resolve) => window.setTimeout(resolve, 0));

60+

}

61+62+

function nextFrame() {

63+

return new Promise<void>((resolve) => {

64+

if (typeof window.requestAnimationFrame !== "function") {

65+

window.setTimeout(resolve, 0);

66+

return;

67+

}

68+

window.requestAnimationFrame(() => resolve());

69+

});

70+

}

71+72+

async function waitForAppUpdates(apps: Iterable<OpenClawApp>) {

73+

for (const app of apps) {

74+

await app.updateComplete;

75+

}

76+

}

77+78+

async function drainAppWork(apps: Iterable<OpenClawApp>) {

79+

const snapshot = [...apps];

80+

await nextMicrotask();

81+

await waitForAppUpdates(snapshot);

82+

await nextFrame();

83+

await nextMicrotask();

84+

await nextFrame();

85+

await nextMicrotask();

86+

await waitForAppUpdates(snapshot);

87+

await nextTimer();

88+

await nextMicrotask();

89+

await waitForAppUpdates(snapshot);

90+

}

91+92+

async function cleanupMountedApps() {

93+

const apps = collectMountedApps();

94+

await drainAppWork(apps);

95+

for (const app of apps) {

96+

app.remove();

97+

}

98+

document.body.replaceChildren();

99+

mountedApps.clear();

100+

await drainAppWork(apps);

101+

}

102+44103

export function mountApp(pathname: string) {

45104

window.history.replaceState({}, "", pathname);

46105

const app = document.createElement("openclaw-app") as OpenClawApp;

106+

mountedApps.add(app);

47107

document.body.append(app);

48108

app.connected = true;

49109

app.requestUpdate();

@@ -96,12 +156,14 @@ export function registerAppMountHooks() {

96156

});

9715798158

afterEach(async () => {

159+

await cleanupMountedApps();

99160

window.__OPENCLAW_CONTROL_UI_BASE_PATH__ = undefined;

100161

getSafeLocalStorage()?.clear();

101162

getSafeSessionStorage()?.clear();

102-

document.body.innerHTML = "";

103163

await i18n.setLocale("en");

164+

vi.restoreAllMocks();

104165

vi.unstubAllGlobals();

105-

await new Promise<void>((resolve) => setTimeout(resolve, 0));

166+

await nextTimer();

167+

await nextMicrotask();

106168

});

107169

}