-
Notifications
You must be signed in to change notification settings - Fork 15
Hot fix on settings reload #322
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
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 |
|---|---|---|
|
|
@@ -160,7 +160,13 @@ func (s *UserSettings) Apply(req UpdateRequest) { | |
| s.EnableTools = *req.EnableTools | ||
| } | ||
| if req.Preferences != nil { | ||
| s.Preferences = req.Preferences | ||
| // Merge preferences instead of replacing them | ||
| if s.Preferences == nil { | ||
| s.Preferences = DefaultPreferences() | ||
| } | ||
| for key, value := range req.Preferences { | ||
| s.Preferences[key] = value | ||
| } | ||
| } | ||
|
Comment on lines
162
to
170
|
||
| } | ||
|
|
||
|
|
||
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.
Initializing with DefaultPreferences() when s.Preferences is nil may not be necessary here, since ensureDefaultPreferences() in the Service layer already handles merging defaults. Consider using an empty map instead (make(map[string]interface{})) to keep the Apply method focused solely on merging the request values without adding default initialization logic.