Migrate remaining Core Data writes to performAndSave
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 42/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- objective-c, swift
- 領域
- database
調査の方向性
Start with the listed call sites, especially NotificationSyncMediator.swift, PostRepository.swift, MediaService.m, and PostTagService.m; read the surrounding code and the existing performAndSave API from #15830. Review each save to determine whether it can use performAndSave or must remain a main-context save, preserving intentional synchronous behavior and documenting those cases. Done means the listed legacy calls are migrated or intentionally retained with comments, and the old save APIs are deprecated.
索引モデルが issue の本文から書いたものです。
説明
Follow-up to #15830, which added performAndSave. That API is now the standard way to write to Core Data (about 180 non-test call sites), but some writes still use the older save calls on ContextManager / CoreDataStack, and a few call NSManagedObjectContext.save() directly. This issue tracks moving them over.
The sites below are a snapshot of trunk at e64c851c0d. Tests and mocks are not included.
Notes for whoever picks this up
- Main-context saves: Many of these save the main context synchronously, and some do so on purpose. For example,
NotificationSyncMediatorusessaveContextAndWaitto avoid animation glitches when pushing the details screen.performAndSavewrites on a new background context, so it can't simply replace those calls. Decide site by site, and leave a short comment wherever a main-context save is intentional. - Direct
context.save()calls: These skipContextManager's error handling and its permanent-ID step (internalSave), so they are worth fixing even where the write stays on the main context. - Objective-C call sites:
performAndSave:andperformAndSave:completion:onQueue:are callable from Objective-C, so these sites can be migrated without moving to Swift first. - End state: Once the migration is complete (or only intentional main-context saves remain), mark
saveContextAndWait(_:),save(_:)andsave(_:completion:on:)as deprecated the waynewDerivedContext()already is, so the old calls don't come back.
Out of scope
ContextManager+ErrorHandling.swift: theinternalSaveimplementation itselfShareExtensionCore/Data/SharedCoreDataStack.swift: the share extension's own stackNullBlogPropertySanitizer.swift: a one-off cleanup during migration
Old ContextManager save calls (56 sites)
Modules/Sources/WordPressData/Swift/ReaderPost.swift
- L23 —
save(_:)
WordPress/Classes/Services/CommentService+Swift.swift
- L85 —
save(_:completion:on:)
WordPress/Classes/Services/Facades/BlogSyncFacade.m
- L66 —
saveContextAndWait
WordPress/Classes/Services/MediaImportService.swift
- L99 —
saveContextAndWait
WordPress/Classes/Services/MediaService.m
- L99 —
saveContext: (ObjC) - L131 —
saveContext: (ObjC) - L148 —
saveContext: (ObjC) - L207 —
saveContext: (ObjC) - L218 —
saveContext: (ObjC) - L359 —
saveContext: (ObjC) - L506 —
saveContext: (ObjC)
WordPress/Classes/Services/MenusService.m
WordPress/Classes/Services/NotificationSyncMediator.swift
- L513`````` —
saveContextAndWait
WordPress/Classes/Services/PostCoordinator.swift
WordPress/Classes/Services/PostRepository.swift
- L146 —
saveContextAndWait - L166 —
saveContextAndWait - L217 —
saveContextAndWait - L277 —
saveContextAndWait - L291 —
saveContextAndWait - L296 —
saveContextAndWait - L317 —
saveContextAndWait - L331 —
saveContextAndWait - L338 —
saveContextAndWait
WordPress/Classes/Services/PostService+Revisions.swift
- L28 —
save(_:completion:on:)
WordPress/Classes/Services/PostService+UnattachedMedia.swift
- L19```````` —
save(_:)
WordPress/Classes/Services/PostTagService.m
- L41 —
saveContext: (ObjC) - L72 —
saveContext: (ObjC) - L93 —
saveContext: (ObjC) - L120 —
saveContext: (ObjC) - L139 —
saveContext: (ObjC) - L248 —
saveContextAndWait - L268 —
saveContextAndWait
WordPress/Classes/Services/Reader Post/ReaderPostService.m
- L255````````` —
saveContext: (ObjC) - L460`````````` —
saveContext: (ObjC)
WordPress/Classes/ViewRelated/Blog/Sharing/SharingButtonsViewController.swift
- L637``````````` —
save(_:completion:on:)
WordPress/Classes/ViewRelated/Blog/Site Picker/BlogList/BlogListViewModel.swift
- L71```````````` —
saveContextAndWait - L76````````````` —
save(_:)
WordPress/Classes/ViewRelated/Comments/Controllers/CommentDetailViewController.swift
- L553`````````````` —
saveContextAndWait
WordPress/Classes/ViewRelated/Domains/Domain registration/RegisterDomainDetails/ViewModel/RegisterDomainDetailsServiceProxy.swift
-
[L221](https://github.com/wordpress-mobile/WordPress-iOS/blob/e64c851c0dd17e57e64424dc1934d7ddad610984/WordPress/Classes/ViewRelated/Domains/Domain%20registration/RegisterDomainDetails/ViewModel/RegisterDomainDetailsServiceProxy.swift#L221)—save(_:)
WordPress/Classes/ViewRelated/Menus/Controllers/MenuItemsViewController.m
- L98```````````````` —
saveContext: (ObjC) - L870````````````````` —
saveContextAndWait
WordPress/Classes/ViewRelated/Menus/Controllers/MenuPostService.m
- L101`````````````````` —
saveContext: (ObjC)
WordPress/Classes/ViewRelated/Menus/Controllers/MenusViewController.m
- L383``````````````````` —
saveContext: (ObjC)
WordPress/Classes/ViewRelated/Post/PostEditor+Publish.swift
- L63```````````````````` —
save(_:) - L239````````````````````` —
saveContextAndWait - L345`````````````````````` —
save(_:)
WordPress/Classes/ViewRelated/Post/PostEditor.swift
- L168 —
saveContextAndWait
WordPress/Classes/ViewRelated/Reader/Comments/ReaderCommentsViewController.swift
- L271```````````````````````` —
save(_:)
WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift
- L139````````````````````````` —
save(_:) - L298`````````````````````````` —
save(_:) - L916``````````````````````````` —
save(_:)
WordPress/Classes/ViewRelated/Reader/Detail/ReaderDetailCoordinator.swift
- L613```````````````````````````` —
save(_:)
Direct NSManagedObjectContext.save() (8 sites)
-
WordPress/Classes/Services/SiteSuggestionService.swiftL94 —try? ContextManager.shared.mainContext.save() -
WordPress/Classes/Services/SuggestionService.swiftL78 —try? blog.managedObjectContext?.save() -
['WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewController.swift' L1935](https://github.com/wordpress-mobile/WordPress-iOS/blob/e64c851c0dd17e57e64424dc1934d7ddad610984/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewController.swift#L1935)—try mainContext.save() -
['WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewModel.swift' L116](https://github.com/wordpress-mobile/WordPress-iOS/blob/e64c851c0dd17e57e64424dc1934d7ddad610984/WordPress/Classes/ViewRelated/Notifications/Controllers/NotificationsViewController/NotificationsViewModel.swift#L116)—try mainContext.save() -
WordPress/Classes/ViewRelated/Reader/Controllers/ReaderHelpers.swiftL131````````````````````````````````` —try? context.save() -
WordPress/Classes/ViewRelated/Reader/Controllers/ReaderPostActions/ReaderBlockUserAction.swiftL45`````````````````````````````````` —try context.save() -
WordPress/Classes/ViewRelated/Reader/Controllers/ReaderPostBlockingController.swiftL90``````````````````````````````````` —try? context.save() -
WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swiftL736```````````````````````````````````` —try? viewContext.save()
Generated by Claude Code
- 主要言語
- Swift
- スター
- 3.9k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 136
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wordpress-mobile/WordPress-iOS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
wordpress-mobile/WordPress-iOS#26423 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wordpress-mobile/WordPress-iOS#26279 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
wordpress-mobile/WordPress-iOS#26276 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
wordpress-mobile/WordPress-iOS#26256 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Status] Ready for Dev [Type] Bug Reader
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
wordpress-mobile/WordPress-iOS#26254 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
wordpress-mobile/WordPress-iOS の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
🎉 Add RemoteCrabオープン
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
jaywcjlove/awesome-mac#4999 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wordpress-mobile/GutenbergKit#940 ·
メンテナーはふだん 1 日以内に返信
-
pending-maintainer-response pending-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-amplify/amplify-swift#4423 ·
メンテナーはふだん 2 日以内に返信
-
tests
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
erkamyaman/unslop-anything#80 ·
メンテナーはふだん 1 日以内に返信