-
Notifications
You must be signed in to change notification settings - Fork 1
fix(config): migrate favorites sidebar shortcut #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -127,10 +127,16 @@ func (a *App) toggleCurrentPageFavoriteAction(ctx context.Context) error { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if uri == "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return fmt.Errorf("favorites unavailable: active page has no URI") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, err := a.deps.FavoritesUC.Toggle(ctx, uri, wv.Title()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result, err := a.deps.FavoritesUC.Toggle(ctx, uri, wv.Title()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if result != nil && strings.TrimSpace(result.Message) != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a.showToastOnLastFocusedBrowserWindow(ctx, result.Message, component.ToastSuccess, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| component.WithDuration(component.ToastBriefDurationMs), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| component.WithPosition(component.ToastPositionBottomRight), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+130
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Bind the toast to the same browser window as the toggled page. This success path re-resolves the focused window via Suggested fix func (a *App) toggleCurrentPageFavoriteAction(ctx context.Context) error {
if a == nil || a.deps == nil || a.deps.FavoritesUC == nil {
return fmt.Errorf("favorites unavailable: usecase not configured")
}
- _, wv := a.activeWebViewForBrowserWindow(a.lastFocusedBrowserWindow())
+ bw := a.lastFocusedBrowserWindow()
+ _, wv := a.activeWebViewForBrowserWindow(bw)
if wv == nil {
return fmt.Errorf("favorites unavailable: no active webview")
}
uri := strings.TrimSpace(wv.URI())
if uri == "" {
@@
}
if result != nil && strings.TrimSpace(result.Message) != "" {
- a.showToastOnLastFocusedBrowserWindow(ctx, result.Message, component.ToastSuccess,
+ a.showToastOnBrowserWindow(ctx, bw, result.Message, component.ToastSuccess,
component.WithDuration(component.ToastBriefDurationMs),
component.WithPosition(component.ToastPositionBottomRight),
)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a.reloadVisibleFavoritesSidebars("current-page-favorite-toggle") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Don't use an explicit empty binding as the obsolete-default sentinel.
keys = []is already a valid persisted shortcut state, so this heuristic cannot distinguish the old shipped default from a user intentionally unbindingctrl+b. Any config that disables the shortcut but keeps the legacy description will now be rewritten back toctrl+bduring bothLoad()andMigrate(), which breaks the “preserve existing custom shortcut bindings” goal.🤖 Prompt for AI Agents