---
name: UI test sharing flow bugs
description: MultiUserSharingUITests reveal real app bugs in the join residence and data refresh flows
type: project
---

MultiUserSharingUITests (8 tests) expose real UI bugs:

**test01-03, 05, 08 fail** because after User B joins a shared residence via the JoinResidenceView UI:
- The join sheet may not dismiss (test01 fails at "Join sheet should dismiss")
- The residence list doesn't refresh to show the newly joined residence
- Tasks and documents from User A don't appear in User B's views

**Root cause candidates:**
1. `JoinResidenceView.joinResidence()` calls `viewModel.joinWithCode()` which on success calls `onJoined()` → `viewModel.loadMyResidences()` but WITHOUT `forceRefresh: true`, so the cached empty list is returned
2. The `ResidencesListView.onAppear` also calls `loadMyResidences()` without `forceRefresh`, hitting cache
3. The join sheet dismissal might fail silently if the API call returns an error

**Why:** Fix the `onJoined` callback in `ResidencesListView.swift` line 97 to call `viewModel.loadMyResidences(forceRefresh: true)` instead of `viewModel.loadMyResidences()`.

**How to apply:** These tests should NOT be worked around with API verification. They correctly test the user's experience. Fix the app, not the tests.
