[Bug]: WebBookmarks typeahead (Alt+O / Cmd+O) is always empty due to unbound `fetchBookmarkSuggestions`
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- electron, typescript
调研方向
从 frontend/app/view/webview/webview.tsx 中的 BookmarkTypeahead 和 WebViewModel.fetchBookmarkSuggestions 开始,跟踪回调如何到达 SuggestionControlInner,并确认其 this 上下文是如何处理的。检查按钮使用的书签文件路径是否与后端读取的路径一致。配置的书签出现在 Alt+O/Cmd+O 的 typeahead 中,并且按钮能够打开配置的书签文件时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Current Behavior
When pressing Alt+O (or Cmd+O on macOS) inside a web widget to open bookmarks, the bookmark typeahead modal appears with the search input, but the dropdown list below it remains completely blank, even when ~/.config/waveterm/bookmarks.json contains valid bookmarks.
Inspecting DevTools inside the web widget reveals an unhandled promise rejection:
TypeError: Cannot read properties of undefined (reading 'env') at fetchBookmarkSuggestions.
Expected Behavior
Configured bookmarks from ~/.config/waveterm/bookmarks.json should appear in the typeahead list when pressing Alt+O / Cmd+O.
Steps To Reproduce
- Add a valid bookmark to
~/.config/waveterm/bookmarks.json:
{
"bookmark@github": {
"url": "https://github.com",
"title": "GitHub"
}
}
- Open Wave Terminal and create a web block.
- Focus the web block and press Alt+O (Windows/Linux) or Cmd+O (macOS).
- The search box appears, but the list underneath is empty.
- Open DevTools for the web widget to observe the uncaught TypeError in the console.
Wave Version
v0.14.5
Platform
Windows
OS Version/Distribution
Windows 11
Architecture
x64
Anything else?
Root Cause
In frontend/app/view/webview/webview.tsx:
fetchBookmarkSuggestionsis defined as an instance method onWebViewModel:
async fetchBookmarkSuggestions(
query: string,
reqContext: SuggestionRequestContext
): Promise<FetchSuggestionsResponse> {
const result = await this.env.rpc.FetchSuggestionsCommand(TabRpcClient, {
suggestiontype: "bookmark",
query,
widgetid: reqContext.widgetid,
reqnum: reqContext.reqnum,
});
return result;
}
- In BookmarkTypeahead (around line 781), it is passed to BlockHeaderSuggestionControl without binding this:
fetchSuggestions={model.fetchBookmarkSuggestions}
When invoked inside SuggestionControlInner, this is undefined, causing this.env.rpc to throw TypeError: Cannot read properties of undefined (reading 'env').
- In SuggestionControlInner, the promise rejection has no .catch() handler, so setFetched(true) is never reached, leaving the dropdown unrendered.
Proposed Fix
- Bind the method when passing it as a callback in BookmarkTypeahead:
- fetchSuggestions={model.fetchBookmarkSuggestions}
+ fetchSuggestions={model.fetchBookmarkSuggestions.bind(model)}
- (Bonus) Line 758 hardcodes ${env.electron.getConfigDir()}/presets/bookmarks.json for the "Open bookmarks.json" button, whereas the backend reads from
${env.electron.getConfigDir()}/bookmarks.json:
- const path = `${env.electron.getConfigDir()}/presets/bookmarks.json`;
+ const path = `${env.electron.getConfigDir()}/bookmarks.json`;
- 主要语言
- Go
- 星标
- 22.7k
- 派生
- 1.2k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wavetermdev/waveterm 的其他 Issue
-
bug triage
难度 2/5 1-3 小时 新手友好度 66/100
wavetermdev/waveterm#3587 ·
维护者通常 1 天内回复
-
pwsh: encodeEnvVarsForPowerShell rejects Windows-standard env var names like ProgramFiles(x86), breaking wsh token on every pwsh block可能已有人在做 @vortsghost2025 于 63 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
wavetermdev/waveterm#3481 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
wavetermdev/waveterm#3435 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
wavetermdev/waveterm#3432 ·
维护者通常 1 天内回复
-
enhancement triage
难度 2/5 1-3 小时 新手友好度 82/100
wavetermdev/waveterm#3431 ·
维护者通常 1 天内回复
查看 wavetermdev/waveterm 的全部 Issue
相似的 Issue
-
bug category:backup
难度 2/5 1-3 小时 新手友好度 73/100
LanternOps/breeze#11743 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
kubescape/synchronizer#208 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 65/100
Azure/azure-storage-azcopy#3681 ·
维护者通常 2 天内回复