You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(webview): bind fetchBookmarkSuggestions and correct bookmarks path - #3604
Bind fetchBookmarkSuggestions: Binds this.fetchBookmarkSuggestions = this.fetchBookmarkSuggestions.bind(this) in the WebViewModel constructor. When BookmarkTypeahead passes model.fetchBookmarkSuggestions to BlockHeaderSuggestionControl, this remains intact, preventing the TypeError: Cannot read properties of undefined (reading 'env') error when fetching suggestions.
Correct bookmarks.json path: Updates the target path for opening bookmarks from ${env.electron.getConfigDir()}/presets/bookmarks.json to ${env.electron.getConfigDir()}/bookmarks.json, matching where the backend loads bookmark configuration.
Tests: Added regression unit test in frontend/app/view/webview/webview.test.tsx verifying that fetchBookmarkSuggestions can be invoked unbound without throwing.
No actionable comments were generated in the recent review.
Walkthrough
The constructor binds fetchBookmarkSuggestions to its model instance. A test checks that the method sends the expected bookmark request fields and returns the received suggestion. The bookmarks editor now opens bookmarks.json directly in the config directory.
The change fixes the bookmark typeahead callback and the path used by the Open bookmarks.json button. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the two changes in the PR: binding fetchBookmarkSuggestions in the WebViewModel constructor and correcting the bookmarks.json path. Both appear in the raw summary and the PR objectives…
Description check
The description covers the changeset. It explains binding fetchBookmarkSuggestions in the constructor, the change from presets/bookmarks.json to bookmarks.json, and the regression test in webview.test…
Linked Issues check
Issue #3568 is the only active direct link. Its coding requirements are (1) make configured bookmarks appear in the Alt+O / Cmd+O typeahead, and (2) correct the "Open bookmarks.json" path to ${env.ele…
Out of Scope Changes check
The reported changes are limited to frontend/app/view/webview/webview.tsx and webview.test.tsx. The constructor bind addresses the #3568 root cause. The path correction addresses the bonus item in #35…
Full details: Title check
Explanation
The title names the two changes in the PR: binding fetchBookmarkSuggestions in the WebViewModel constructor and correcting the bookmarks.json path. Both appear in the raw summary and the PR objectives. The title is specific and matches the main change. The conventional-commit prefix is acceptable.
Full details: Description check
Explanation
The description covers the changeset. It explains binding fetchBookmarkSuggestions in the constructor, the change from presets/bookmarks.json to bookmarks.json, and the regression test in webview.test.tsx. It also references issue #3568. This matches the summary of changes.
Full details: Linked Issues check
Explanation
Issue #3568 is the only active direct link. Its coding requirements are (1) make configured bookmarks appear in the Alt+O / Cmd+O typeahead, and (2) correct the "Open bookmarks.json" path to ${env.electron.getConfigDir()}/bookmarks.json. Requirement 1: at head, the WebViewModel constructor in frontend/app/view/webview/webview.tsx contains this.fetchBookmarkSuggestions = this.fetchBookmarkSuggestions.bind(this). The unbound callback that caused TypeError: Cannot read properties of undefined (reading 'env') is therefore fixed. The issue's proposed call-site .bind(model) would also work; the constructor bind is an equivalent fix. Requirement 2: the PR summary states the path changed from presets/bookmarks.json to bookmarks.json. I did not read that hunk directly because the file read was truncated, so this rests on the supplied summary and PR description. A regression test in webview.test.tsx is also reported. I did not read the test diff. Both diff reads failed, so the test's content is unverified. No unmet coding requirement is identified.
Full details: Out of Scope Changes check
Explanation
The reported changes are limited to frontend/app/view/webview/webview.tsx and webview.test.tsx. The constructor bind addresses the #3568 root cause. The path correction addresses the bonus item in #3568. The regression test covers the bind fix. Each change connects directly to #3568 and no unrelated change is reported. The test file was not read directly, so the connection of its content to the bind fix relies on the summary.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: d2bf7252-045b-48f5-a65a-8c0fddd74078
Commits
Reviewing files that changed from the base of the PR and between 9f1c967 and e183a17.
Files selected for processing: 2
frontend/app/view/webview/webview.test.tsx
frontend/app/view/webview/webview.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
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
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
Fixes #3568.
fetchBookmarkSuggestions: Bindsthis.fetchBookmarkSuggestions = this.fetchBookmarkSuggestions.bind(this)in theWebViewModelconstructor. WhenBookmarkTypeaheadpassesmodel.fetchBookmarkSuggestionstoBlockHeaderSuggestionControl,thisremains intact, preventing theTypeError: Cannot read properties of undefined (reading 'env')error when fetching suggestions.bookmarks.jsonpath: Updates the target path for opening bookmarks from${env.electron.getConfigDir()}/presets/bookmarks.jsonto${env.electron.getConfigDir()}/bookmarks.json, matching where the backend loads bookmark configuration.frontend/app/view/webview/webview.test.tsxverifying thatfetchBookmarkSuggestionscan be invoked unbound without throwing.