fix(swift): flush the outbox from macOS standalone Pack/Trip windows - #2676
Conversation
On macOS a pack or trip can be opened in its own window, and those windows host the same detail views as the main window — so they queue writes of their own via `PackDetailView`'s deleteItem/updateItem. Only the main window carried `.flushesPendingWrites()`, so writes made in a standalone window stayed queued until the user returned to the main window. Not data loss (mutations are durable and the main window still flushes on foreground/reconnect), but sync stalls for anyone working primarily in a standalone window. Attach the modifier to both macOS `WindowGroup`s. `OutboxService.flush` already guards on `isFlushing`, so multiple windows cannot double-send a mutation. Refs #2672
|
Warning Review limit reached
Next review available in: 9 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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 |
Coverage Report for packages/units (./packages/units)
File CoverageNo changed files found. |
Coverage Report for packages/utils (./packages/utils)
File CoverageNo changed files found. |
Coverage Report for packages/analytics (./packages/analytics)
File CoverageNo changed files found. |
Coverage Report for apps/expo (./apps/expo)
File CoverageNo changed files found. |
Coverage Report for packages/overpass (./packages/overpass)
File CoverageNo changed files found. |
Coverage Report for packages/mcp (./packages/mcp)
File CoverageNo changed files found. |
Coverage Report for packages/api (./packages/api)
File CoverageNo changed files found. |
Follow-up to #2673 (merged), which added the offline write outbox.
Problem
On macOS a pack or trip can be opened in its own window (
Open in New Window), and those windows host the same detail views as the main window — so they queue writes of their own throughPackDetailView'sdeleteItem/updateItem.Only the main window carried
.flushesPendingWrites(). Writes made in a standalone window were queued correctly but that window never drained them, so sync stalled until the user returned to the main window.This is not data loss —
PendingMutationrows are durable and the main window still flushes on foreground and reconnect — but it's a real stall for anyone working primarily in a standalone window.Change
Attach
.flushesPendingWrites()to both macOSWindowGroups.OutboxService.flushalready guards onisFlushing, so multiple windows cannot double-send a mutation.Scope
PackRat-macOScompiles the sameSources/PackRatas the iOS target, so the outbox itself was already present on macOS — this closes the one platform-specific gap in how it gets drained.Testing
Not verified on a running macOS build. The original outbox work was device-tested end-to-end on iOS (offline create and delete reaching a live API); this change is the same modifier already proven there, applied to two additional scenes.