Fix bookmark typeahead not rendering suggestions#3420
Conversation
fetchBookmarkSuggestions was a plain class method passed by reference to BlockHeaderSuggestionControl, so calling it lost its `this` binding and threw on `this.env`, silently rejecting the suggestions promise with no error handling. That kept `fetched` false forever, so neither the list nor the empty state ever rendered. Also fixes the "Open bookmarks.json" button, which pointed at presets/bookmarks.json instead of the actual config path used to load bookmarks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
WalkthroughThis change modifies frontend/app/view/webview/webview.tsx in two ways: it converts the WebViewModel's fetchBookmarkSuggestions from an async class method into an async arrow-function class field to ensure proper this-binding when used as a callback, and it updates the bookmarks JSON file path in openBookmarksJson from configDir/presets/bookmarks.json to configDir/bookmarks.json. Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
fetchBookmarkSuggestionswas a plain class method passed by reference toBlockHeaderSuggestionControl(fetchSuggestions={model.fetchBookmarkSuggestions}).Calling it as a bare function lost its
thisbinding, sothis.envthrew aTypeErrorinside the method. The rejection had no.catch, sofetchednever flipped to
trueand neither the bookmark list nor the empty stateever rendered — pressing
Cmd+Ojust showed an empty input with nothingbelow it.
presets/bookmarks.json, a path nothing else reads from or writes to.Bookmarks are actually loaded from
<configDir>/bookmarks.json. Clickingthe button created a dead file that had no effect on the app.
Fix
fetchBookmarkSuggestionsto an arrow function class field sothisstays bound to theWebViewModelinstance regardless of how it'sinvoked.
<configDir>/bookmarks.json.