refactor: WelcomeViewModel, ERDiagram, ResultTabBar#892
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d5d6689a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let observer = NotificationCenter.default.addObserver( | ||
| forName: .databaseDidConnect, object: nil, queue: .main | ||
| ) { _ in | ||
| resumeOnce() |
There was a problem hiding this comment.
Scope connection notification before resuming load
waitForConnection() resumes on any .databaseDidConnect event because the observer is registered with object: nil and the callback does not verify which connection actually finished. In this codebase those notifications are emitted globally (DatabaseManager+Sessions.swift and DatabaseManager+Health.swift), so a different session reconnecting can wake this continuation and make loadDiagram() fail with "No database connection" for the requested connectionId even though it is still connecting.
Useful? React with 👍 / 👎.
| if DatabaseManager.shared.driver(for: connectionId) == nil { | ||
| await waitForConnection() |
There was a problem hiding this comment.
Re-check driver after registering connect observer
This pre-check waits only once before subscribing, and waitForConnection() does not perform an immediate post-subscription driver check. If the target connection is established in the small window between this driver(for:) == nil test and observer registration, its connect notification is missed and the code unnecessarily waits for the full 10-second timeout before loading the diagram.
Useful? React with 👍 / 👎.
Summary
Second round of macOS HIG audit fixes, addressing MVVM layer violations, polling patterns, and remaining accessibility gaps.
WelcomeViewModel MVVM cleanup
pendingConnectionShareURLandpendingDeeplinkImportfrom AppDelegate intoPendingActionStoresingleton — ViewModel no longer castsNSApp.delegateNSOpenPanelin ViewModel with.fileImportermodifier in ViewNSAlertin ViewModel with.alertmodifier in View.focusConnectionFormWindowRequestednotificationERDiagramViewModel reactive connection wait
.databaseDidConnectOSAllocatedUnfairLockfor safe single-resume ofCheckedContinuationQuick UI fixes
.onTapGesturereplaced withButtonfor keyboard/VoiceOver accessibility.listStyle(.plain)changed to.listStyle(.sidebar)per macOS HIGTest plan
.tableproshare file — import sheet appears