android, desktop, ios: gate picker mention-id and max-reached banner by memberMentions

With the sticky cache, the picker's "currently bound member" highlight
and the showMaxReachedBox banner-suppression clause read mentions[name]
directly, so a stale cache entry made one row clickable (as a no-op) at
the MAX limit and could suppress the banner when the user is actually
adding a new mention. Both now gate the lookup by membership in the
capped memberMentions, restoring the pre-fix UX where at MAX all rows
are disabled and the banner shows when adding past the limit.
This commit is contained in:
Narasimha-sc
2026-06-06 14:17:25 +00:00
parent fe5552cdbd
commit e989caba64
2 changed files with 3 additions and 3 deletions
@@ -130,7 +130,7 @@ struct GroupMentionsView: View {
isVisible = true
mentionName = name
mentionRange = r
mentionMemberId = composeState.mentions[name]?.memberId
mentionMemberId = composeState.memberMentions[name] != nil ? composeState.mentions[name]?.memberId : nil
if !m.membersLoaded {
Task {
await m.loadGroupMembers(groupInfo)
@@ -112,7 +112,7 @@ fun GroupMentions(
isVisible.value = true
mentionName.value = ft.format.memberName
mentionRange.value = r
mentionMemberId.value = composeState.value.mentions[mentionName.value]?.memberId
mentionMemberId.value = if (mentionName.value in composeState.value.memberMentions) composeState.value.mentions[mentionName.value]?.memberId else null
if (!chatModel.membersLoaded.value) {
scope.launch {
setGroupMembers(rhId, chatInfo.groupInfo, chatModel)
@@ -210,7 +210,7 @@ fun GroupMentions(
},
contentAlignment = Alignment.BottomStart
) {
val showMaxReachedBox = composeState.value.memberMentions.size >= MAX_NUMBER_OF_MENTIONS && isVisible.value && composeState.value.mentions[mentionName.value] == null
val showMaxReachedBox = composeState.value.memberMentions.size >= MAX_NUMBER_OF_MENTIONS && isVisible.value && mentionName.value !in composeState.value.memberMentions
LazyColumnWithScrollBarNoAppBar(
Modifier
.heightIn(max = MAX_PICKER_HEIGHT)