Fix meal plan not populating on first login and add pull-to-refresh sync
Rewrite MealPlanSyncManager.performSync() (renamed from performInitialSync) to discover _mealPlanAssignment metadata from all server recipes, not just locally- known ones. On first sync all recipes are checked; on subsequent syncs only recipes modified since lastMealPlanSyncDate are fetched (max 5 concurrent). Trigger meal plan sync from pull-to-refresh on both the recipe and meal plan tabs, and from the "Refresh all" toolbar button. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,7 @@ class GroceryStateSyncManager {
|
||||
// MARK: - Initial Sync
|
||||
|
||||
/// Pushes any local-only items and reconciles server items on app launch.
|
||||
func performInitialSync() async {
|
||||
func performSync() async {
|
||||
guard let appState, let groceryManager else { return }
|
||||
|
||||
await loadPendingRemovals()
|
||||
@@ -208,7 +208,7 @@ class GroceryStateSyncManager {
|
||||
// MARK: - Pending Removal Tracking
|
||||
|
||||
/// Records a recipe ID whose grocery items were fully removed, so that
|
||||
/// `performInitialSync` can push the deletion even after the key disappears
|
||||
/// `performSync` can push the deletion even after the key disappears
|
||||
/// from `groceryDict`.
|
||||
func trackPendingRemoval(recipeId: String) {
|
||||
pendingRemovalRecipeIds.insert(recipeId)
|
||||
|
||||
Reference in New Issue
Block a user