fix(audio-rooms): unwrap hiddenUsers State for the feed key (audit walk #9)

Pre-existing bug surfaced during the user-walkthrough audit:
WatchAccountForAudioRoomsScreen used `val hiddenUsers =
hiddenUsers.flow.collectAsStateWithLifecycle()` (no `by`), so the
LaunchedEffect captured a State<T> object as a key rather than
the unwrapped value. State equality is reference-based and the
remembered State instance is stable across recompositions, so the
effect never re-fired when the user muted someone — the rooms
feed showed stale results until a manual refresh.

Switching to `val hiddenUsers by ...` unwraps the value so
LaunchedEffect re-keys when the hidden-users set changes.
This commit is contained in:
Claude
2026-04-27 02:53:53 +00:00
parent e041c77832
commit e3bf46377b
@@ -133,9 +133,13 @@ fun WatchAccountForAudioRoomsScreen(
accountViewModel: AccountViewModel,
) {
val listState by accountViewModel.account.liveLiveStreamsFollowLists.collectAsStateWithLifecycle()
val hiddenUsers =
accountViewModel.account.hiddenUsers.flow
.collectAsStateWithLifecycle()
// Use `by` to unwrap the StateFlow's value into the LaunchedEffect
// key — without it, the State<T> object is reference-stable across
// recompositions and the effect never re-fires when the user
// mutes someone, leaving the rooms feed stale until a manual
// refresh.
val hiddenUsers by accountViewModel.account.hiddenUsers.flow
.collectAsStateWithLifecycle()
LaunchedEffect(accountViewModel, listState, hiddenUsers) {
audioRoomsFeedState.checkKeysInvalidateDataAndSendToTop()