Migrate remaining Core Data writes to performAndSave
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- objective-c, swift
- Ambito
- database
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Swift
- Stelle
- 3.9k
- Fork
- 1.2k
- Merge medio
- 1g 23h
- PR unite (30g)
- 136
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wordpress-mobile/WordPress-iOS
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Status] Ready for Dev [Type] Bug Reader
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wordpress-mobile/WordPress-iOS
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
🎉 Add RemoteCrabAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
jaywcjlove/awesome-mac#4999 ·
I maintainer di solito rispondono entro 1 giorno
-
[Type] Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
wordpress-mobile/GutenbergKit#940 ·
I maintainer di solito rispondono entro 1 giorno
-
pending-maintainer-response pending-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws-amplify/amplify-swift#4423 ·
I maintainer di solito rispondono entro 2 giorni
-
tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
erkamyaman/unslop-anything#80 ·
I maintainer di solito rispondono entro 1 giorno