Skip to content

fix: refresh cached miniapp urls#15146

Merged
DeJeune merged 2 commits into
CherryHQ:mainfrom
mturac:hotfix/issue-14415-openclaw-dashboard-token
May 28, 2026
Merged

fix: refresh cached miniapp urls#15146
DeJeune merged 2 commits into
CherryHQ:mainfrom
mturac:hotfix/issue-14415-openclaw-dashboard-token

Conversation

@mturac
Copy link
Copy Markdown
Contributor

@mturac mturac commented May 17, 2026

What this PR does

Before this PR:

Opening a keep-alive mini-app with an existing id reused the cached app config without refreshing its URL. Dynamic mini-app URLs, including the OpenClaw dashboard URL with its auth token, could therefore reopen with a stale tokenless URL.

After this PR:

Keep-alive mini-app opens always refresh the cached config before showing the app. Existing OpenClaw dashboard tabs now receive the latest tokenized URL from getDashboardUrl().

Fixes #14415

Why we need it and why it was done in this way

The following tradeoffs were made:

This keeps the fix in the shared mini-app cache path instead of adding OpenClaw-specific reload code, so every dynamic mini-app URL benefits from the same behavior.

The following alternatives were considered:

Closing and recreating the OpenClaw dashboard tab on every open was considered, but refreshing the cached config is smaller and preserves the existing keep-alive behavior.

Links to places where the discussion took place: #14415

Breaking changes

None.

Special notes for your reviewer

Touched surface: renderer mini-app popup cache behavior. Validation run:

  • corepack pnpm biome check src/renderer/src/hooks/useMinappPopup.ts
  • corepack pnpm exec tsc --noEmit -p tsconfig.web.json --composite false

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and keep it simple
  • Refactor: The change is minimal and scoped to the bug
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Documentation: Not required; this fixes existing behavior
  • Self-review: I have reviewed my own code before requesting review from others

Release note

Fix OpenClaw dashboard mini-app opens so the cached tab uses the latest authenticated URL.

Copy link
Copy Markdown
Collaborator

@GeorgeDong32 GeorgeDong32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: LGTM ✅

变更精准修复了 #14415,符合 hotfix 最小范围原则。

核心改动: 将 mini-app 缓存策略从"仅缓存新条目"改为"始终刷新缓存",确保动态 URL(如 OpenClaw 带 auth token 的 dashboard URL)在重新打开时获取最新 URL。

审查要点:

  • ✅ 正确性: LRUCache.set() 对已有 key 原地更新,行为正确
  • ✅ 安全性: 确保 auth token 每次打开时刷新,避免使用过期 token
  • ✅ 性能: 移除不必要的 get() 调用,set() 同样会将条目移到最近使用位置
  • ✅ 一致性: 两处改动(openMinappopenSmartMinapp)保持相同模式
  • ✅ CI 全部通过

@GeorgeDong32 GeorgeDong32 requested a review from ousugo May 18, 2026 11:03
Signed-off-by: mehmet turac <mehmetturac@gmail.com>
@mturac mturac force-pushed the hotfix/issue-14415-openclaw-dashboard-token branch from 95d72c3 to b283e63 Compare May 18, 2026 11:43
Copy link
Copy Markdown
Collaborator

@ousugo ousugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该 PR 成功修复了 OpenClaw 等动态小应用 URL 刷新滞后的问题。通过强制更新缓存,确保了 Token 的实时性。建议在 \useMinappPopup\ 中增加配置变化检查,以避免在 URL 未变动时触发不必要的组件重绘或 WebView 重新加载。此外,注意到 Tab 模式下部分状态同步可能存在微小延迟,但不影响核心功能修复。

if (!cacheApp) minAppsCache.set(app.id, app)
// Always refresh the cached config. Some apps, such as OpenClaw, use
// short-lived URLs with auth tokens and must not reuse a stale entry.
minAppsCache.set(app.id, app)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[B1] 每次调用 \openMinapp\ 都会触发 \minAppsCache.set\,即便 \�pp\ 的配置(特别是 \url\)没有发生变化。这会导致 Redux 状态产生新的引用并触发相关组件重绘,对于已打开的 WebView 也会导致其重新加载。建议在 \set\ 之前检查 \url\ 是否变化以避免不必要的重载。

}
// Refresh temporary app config so dynamic URLs such as OpenClaw's
// dashboard token are propagated when the tab already exists.
minAppsCache.set(config.id, config)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[B1] 同上,在 \openSmartMinapp\(Tab 模式)中,点击已激活的 Tab 也会触发强制刷新。建议增加变化检查以保持与其它 Tab 系统一致的交互体验。

@DeJeune DeJeune merged commit 4f4a9d8 into CherryHQ:main May 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OpenClaw dashboard opens without auth token — 'gateway token missing', completely unusable on first install

4 participants