Conversation
📝 WalkthroughWalkthroughThis PR refactors the settings notification architecture by removing seven domain-specific notification names and a SettingsChangeInfo payload struct from the notification layer. AppSettingsManager now posts notifications differently, QueryHistoryManager replaces NotificationCenter subscription with an explicit applySettingsChange() method, and UI views switch from notification observers to direct setting observation or onChange triggers. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
TablePro/Core/Storage/AppSettingsManager.swift (1)
82-85:⚠️ Potential issue | 🟠 MajorApply history settings inline instead of hopping through
Task.After this refactor,
applyHistorySettingsImmediately()is just a synchronous@MainActorcall intoQueryHistoryManager.shared.applySettingsChange(). Wrapping it inTaskdelaysupdateSettingsCache(), soQueryHistoryStoragecan briefly keep the old retention limits afterhistorychanges. Any history write in that window still uses stale settings. Calling it inline closes that gap, andstorage.cleanup()already moves its work off the main actor anyway.🛠️ Proposed fix
- Task { await applyHistorySettingsImmediately() } + applyHistorySettingsImmediately() @@ - private func applyHistorySettingsImmediately() async { + private func applyHistorySettingsImmediately() { QueryHistoryManager.shared.applySettingsChange() }Also applies to: 178-180
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@TablePro/Core/Storage/AppSettingsManager.swift` around lines 82 - 85, Replace the asynchronous fire-and-forget Task call with an inline await call so settings are applied immediately: after storage.saveHistory(validated) and the other occurrence (lines around the second save), call await applyHistorySettingsImmediately() directly instead of wrapping it in Task { await applyHistorySettingsImmediately() }; this ensures updateSettingsCache() and QueryHistoryStorage see the new retention limits immediately—applySettingsChange() on QueryHistoryManager.shared and storage.cleanup() can remain unchanged.
🧹 Nitpick comments (1)
docs/development/plugin-settings-tracking.md (1)
21-29: Avoid hard-coded source line numbers in this doc.These references already drifted in this PR. Prefer symbol names or file-only references so routine refactors in
PluginManager.swiftdo not force doc churn.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/development/plugin-settings-tracking.md` around lines 21 - 29, Replace the hard-coded source line numbers with stable identifiers: use file-only references (e.g., Core/Plugins/PluginManager.swift) and, where relevant, symbol or method names (e.g., PluginManager.register/unregister, PluginManager.verifyCodeSignature, InstalledPluginsView, BrowsePluginsView, RegistryPluginRow, PluginInstallModifier) instead of "PluginManager.swift:382" or ":586"; update each table row to reference the file or symbol name and a short context note (e.g., "PluginManager.register/unregister — immediate capability register/unregister") so routine refactors won't require doc changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@TablePro/Core/Storage/AppSettingsManager.swift`:
- Around line 82-85: Replace the asynchronous fire-and-forget Task call with an
inline await call so settings are applied immediately: after
storage.saveHistory(validated) and the other occurrence (lines around the second
save), call await applyHistorySettingsImmediately() directly instead of wrapping
it in Task { await applyHistorySettingsImmediately() }; this ensures
updateSettingsCache() and QueryHistoryStorage see the new retention limits
immediately—applySettingsChange() on QueryHistoryManager.shared and
storage.cleanup() can remain unchanged.
---
Nitpick comments:
In `@docs/development/plugin-settings-tracking.md`:
- Around line 21-29: Replace the hard-coded source line numbers with stable
identifiers: use file-only references (e.g., Core/Plugins/PluginManager.swift)
and, where relevant, symbol or method names (e.g.,
PluginManager.register/unregister, PluginManager.verifyCodeSignature,
InstalledPluginsView, BrowsePluginsView, RegistryPluginRow,
PluginInstallModifier) instead of "PluginManager.swift:382" or ":586"; update
each table row to reference the file or symbol name and a short context note
(e.g., "PluginManager.register/unregister — immediate capability
register/unregister") so routine refactors won't require doc changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3a121119-8ecd-45d4-91e5-a6dc38d41a85
📒 Files selected for processing (7)
TablePro/Core/Services/Infrastructure/SettingsNotifications.swiftTablePro/Core/Storage/AppSettingsManager.swiftTablePro/Core/Storage/QueryHistoryManager.swiftTablePro/Resources/Localizable.xcstringsTablePro/Views/Editor/QueryEditorView.swiftTablePro/Views/Editor/SQLEditorView.swiftdocs/development/plugin-settings-tracking.md
Summary
NotificationCenternotification names (appearanceSettingsDidChange,generalSettingsDidChange,tabSettingsDidChange,keyboardSettingsDidChange,aiSettingsDidChange,settingsDidChange,historySettingsDidChange) and theSettingsChangeInfoinfrastructurehistorySettingsDidChangeCombine subscriber inQueryHistoryManagerwith a directapplySettingsChange()call fromAppSettingsManager.onReceivenotification subscribers to@Observableobservation (.onChange(of:)inSQLEditorView, direct property read inQueryEditorView)dataGridSettingsDidChange,editorSettingsDidChange(AppKit bridges),accessibilityTextSizeDidChange(system event)Net: -259 lines across both commits. Zero
Combineimports remain in settings code.Test plan
QueryEditorViewtoolbar appears/disappearsTablePro/Summary by CodeRabbit
Refactor
Documentation