Fix bookmark typeahead not rendering suggestions#3420
Open
G-Gamja wants to merge 1 commit into
Open
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>
Contributor
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.