Fix: invited members now see shared tasks immediately on join

Product bug: when a user joined a shared residence, the residence appeared but
its tasks (created by the owner) did not show in the Tasks tab until a manual
refresh. Root cause was client-side — APILayer.joinWithCode updated the
residence cache (addResidence) but never refreshed the tasks cache, and the
optimistic addResidence suppressed getMyResidences' count-based task
invalidation, so allTasks stayed a stale pre-join snapshot. The backend was
correct (task list query already joins residence_residence_users).

- APILayer.joinWithCode: call getTasks(forceRefresh = true) on success
  (mirrors bulkCreateTasks) so the joined residence's tasks load immediately.
- ResidenceViewModel: corrected an inaccurate comment about join-time refresh.
- SharingUITests.test03: un-quarantined — now passes (verified against live stack).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-06-06 09:17:20 -05:00
parent a3b684744b
commit 73a60c886d
3 changed files with 8 additions and 15 deletions
@@ -562,6 +562,11 @@ object APILayer {
if (result is ApiResult.Success) {
DataManager.setTotalSummary(result.data.summary)
DataManager.addResidence(result.data.residence)
// Proactive refresh — the optimistic addResidence above suppresses
// getMyResidences' count-based task invalidation, so fetch fresh
// tasks here so the joined residence's tasks appear immediately
// without a manual refresh.
getTasks(forceRefresh = true)
}
return result