[Bug]: WebBookmarks typeahead (Alt+O / Cmd+O) is always empty due to unbound `fetchBookmarkSuggestions`

Ouverte Adaptée aux débutants
#3,568 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
75/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
electron, typescript

Piste de recherche

Commencez dans frontend/app/view/webview/webview.tsx, au niveau de BookmarkTypeahead et de WebViewModel.fetchBookmarkSuggestions ; suivez le chemin du callback jusqu’à SuggestionControlInner et vérifiez comment son contexte this est géré. Vérifiez que le chemin du fichier de favoris utilisé par le bouton correspond à celui lu par le backend. Le travail est terminé lorsque les favoris configurés apparaissent dans la saisie semi-automatique d’Alt+O/Cmd+O et que le bouton ouvre le fichier de favoris configuré.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug triage
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
  1. Add a valid bookmark to ~/.config/waveterm/bookmarks.json:
   {
     "bookmark@github": {
       "url": "https://github.com",
       "title": "GitHub"
     }
   }
  1. Open Wave Terminal and create a web block.
  2. Focus the web block and press Alt+O (Windows/Linux) or Cmd+O (macOS).
  3. The search box appears, but the list underneath is empty.
  4. 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:

  1. fetchBookmarkSuggestions is defined as an instance method on WebViewModel:
   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;
   }
  1. 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').

  1. In SuggestionControlInner, the promise rejection has no .catch() handler, so setFetched(true) is never reached, leaving the dropdown unrendered.
Proposed Fix
  1. Bind the method when passing it as a callback in BookmarkTypeahead:
- fetchSuggestions={model.fetchBookmarkSuggestions}
+ fetchSuggestions={model.fetchBookmarkSuggestions.bind(model)}
  1. (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`;
Langage dominant
Go
Étoiles
22.7k
Forks
1.2k
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de wavetermdev/waveterm

Toutes les issues de wavetermdev/waveterm

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.