Apply defaults when loading local configuration#3727
Apply defaults when loading local configuration#3727davidpaquin wants to merge 2 commits intomattermost:masterfrom
Conversation
|
Hello @davidpaquin, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
📝 WalkthroughWalkthroughReturn order in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip Migrating from UI to YAML configuration.Use the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main/app/config.ts`:
- Around line 36-37: The current top-level spread of Config.defaultData and
Config.localData causes partial local notifications to overwrite defaults;
change the merge so nested notifications are merged too—e.g., after the
top-level spread merge, explicitly merge notifications by combining
Config.defaultData.notifications with Config.localData.notifications so fields
like bounceIconType are preserved when not provided locally; update the merge
logic around the existing spread usage of Config.defaultData and
Config.localData in config.ts (reference Config.defaultData, Config.localData,
notifications, bounceIconType) or use a deep-merge utility (lodash.merge) to
achieve the same result.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f6415be0-4bad-40b2-83b2-ae9608d0bc1a
📒 Files selected for processing (1)
src/main/app/config.ts
ff60950 to
de4f61b
Compare
devinbinnie
left a comment
There was a problem hiding this comment.
LGTM! Thanks @davidpaquin!
|
/update-branch |
Summary
Default preferences were not being applied when loading local configuration.
This meant that settings that were not required/defaulted in the Joi spec (e.g. notification settings) would cause issues for consumers that expected those fields to be populated. In the issue linked below, this caused a rendering crash that would leave a transparent window over the main window, making nothing clickable.
Ticket Link
Fixes #3726
Checklist
npm run lint:jsfor proper code formattingDevice Information
This PR was tested on:
macOS Tahoe 26.3
Screenshots
Before:
Screen.Recording.2026-03-13.at.10.43.42.PM.mov
After:
Screen.Recording.2026-03-13.at.10.40.55.PM.mov
Release Note
Change Impact: 🟡 Medium
Reasoning: The change is localized to the IPC handler that returns local configuration to renderer processes, ensuring default preference fields are applied. While the change is small and follows a safe defaults-overridden-by-local pattern, it affects multiple renderer components that consume configuration, and it fixes a critical user-facing crash.
Regression Risk: Moderate — the function alters the shape of config objects by populating previously-missing fields; if any renderer code relied on those fields being undefined, behavior could change. There are no unit tests added for this path, increasing risk slightly.
QA Recommendation: Perform focused manual QA: open Settings → Notifications and verify the tab renders without crashing and shows default notification preferences; confirm existing user preferences remain respected; smoke-test other settings panes (General, Spell Checker, Server Management) and basic app startup flows. Skipping manual QA is not recommended due to the UI crash this change addresses.
Generated by CodeRabbitAI