Skip to content

sync feeding snapshot to support multi-device sessions#290

Merged
kishorepran merged 1 commit intodevelopfrom
bug/EPMEDU-2649-cannot-finish-feeding-cross-device
Mar 18, 2026
Merged

sync feeding snapshot to support multi-device sessions#290
kishorepran merged 1 commit intodevelopfrom
bug/EPMEDU-2649-cannot-finish-feeding-cross-device

Conversation

@Giorgi217
Copy link
Copy Markdown
Collaborator

@Giorgi217 Giorgi217 commented Mar 2, 2026

Pull Request overview

Fix multi-device feeding state — enable finish & cancel on secondary devices


Problem

Users who started feeding on one device could see “Feeding in progress” on another device but were unable to finish or cancel the feeding.

Root cause:

  • Feeding actions relied on a locally stored snapshot
  • On a new device the snapshot did not exist
  • Mutations were sent with an empty or invalid identifier
  • As a result, finish and cancel operations failed despite the feeding being active on the backend

Summary

This PR introduces a minimal, non-breaking fix:

  • Synchronizes the local feeding snapshot with the server’s active feeding when an unfinished feeding is detected
  • Ensures the correct identifier is available for finish and cancel actions on any device -

Changes

File What changed
HomeModel.swift Added updateFeedingSnapshot(id:date:) to refresh snapshot from server data
HomeContract.swift Exposed updateFeedingSnapshot in protocol
HomeViewModel.swift Updates snapshot when unfinished feeding is detected

🧠 How it works (High level)

  1. App launches or Home loads
  2. Active feeding is fetched from the backend
  3. Local snapshot is refreshed using server data
  4. UI resumes feeding state safely on any device
  5. Finish and cancel actions now use a valid identifier

How to test

Multi-device scenario

  1. Start feeding on Device A
  2. Open the app on Device B with the same account
  3. Feeding should appear as in progress
  4. Try to finish feeding → should succeed
  5. Start feeding again and try cancel → should succeed

Notes

This PR intentionally avoids removing or redesigning the snapshot system to keep changes minimal and safe. A future refactor may further simplify feeding session management if needed.


Device 1 (Starting Feeding)

Simulator Screenshot - iPhone 17 Pro - 2026-03-02 at 15 28 59

Device 2 (Finishing Feeding)

Simulator Screenshot - iPhone 15 Pro - 2026-03-02 at 15 37 58 Simulator Screenshot - iPhone 15 Pro - 2026-03-02 at 15 38 07 Simulator Screenshot - iPhone 15 Pro - 2026-03-02 at 15 38 26

@kishorepran kishorepran merged commit 5e210f8 into develop Mar 18, 2026
2 checks passed
@kishorepran kishorepran deleted the bug/EPMEDU-2649-cannot-finish-feeding-cross-device branch March 18, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants