Skip to content

[Payment due] [$250] Group - Group chat members reappears when remove from group #79430

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.0-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-2923/folder/13176684/41236579/1121355543?sort=-status_id
Email or phone of affected tester (no customers): gocemate+b215490600@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10/Chrome
App Component: Other

Action Performed:

  1. Create group chat
  2. Invite few members
  3. Remove the members

Expected Result:

Members should be removed

Actual Result:

Removed members re-appears in flash.
Same behavior when remove member from custom room

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @RachCHopkins
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022026368325798161561
  • Upwork Job ID: 2026368325798161561
  • Last Price Increase: 2026-02-24

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 13, 2026
  2. melvin-bot commented on Jan 13, 2026

    @melvin-bot

    Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. daledah commented on Jan 13, 2026

    @daledah
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When removing members from a group chat or custom room, the removed members briefly re-appear (flash) in the members list after being removed, even though they should be immediately hidden from the list.

    What is the root cause of that problem?

    The root cause is in the removeFromRoom function in src/libs/actions/Report.ts.

    When removing members, the optimistic data only updates pendingChatMembers in REPORT_METADATA:

    App/src/libs/actions/Report.ts

    Lines 4096 to 4104 in 98a3245

    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers,
    },
    },
    ];

    However, it does not remove the participants from report.participants. The participants are only removed in the success data (lines 4118-4125), which arrives after the API call completes.

    This causes removed members to remain in the report.participants array temporarily. The UI in RoomMembersPage.tsx loops through all participants from the report and only disables items with pending DELETE action. During re-renders or race conditions between optimistic and success updates, removed members can briefly flash back into view.

    What changes do you think we should make in order to solve the problem?

    Update the optimisticData in the removeFromRoom function to also remove participants from report.participants immediately and reset in failureData:

    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
            value: {
                participants: removeParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
            value: {
                pendingChatMembers,
            },
        },
    ];

    App/src/libs/actions/Report.ts

    Lines 4096 to 4104 in 98a3245

    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers,
    },
    },
    ];

    This aligns with how the success data already works and ensures removed members are immediately hidden from the participants list.

    Note: we should do the same with other places that have the same problem

    What alternative solutions did you explore? (Optional)

    An alternative would be to filter out participants with pending DELETE action in all places where the members list is rendered. However, this would require changes across multiple components and doesn't solve the fundamental issue that the optimistic data should reflect the intended state immediately. Fixing it at the source (in removeFromRoom) is more robust and prevents the flash from occurring in the first place.

  4. dmkt9 commented on Jan 13, 2026

    @dmkt9
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Removed members re-appears in flash.
    Same behavior when remove member from custom room

    What is the root cause of that problem?

    After the request succeeds, successData will be merged.

    App/src/libs/actions/Report.ts

    Lines 4118 to 4133 in 7d00137

    const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
    value: {
    participants: removeParticipantsData,
    },
    },
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
    },
    },
    ];

    We rely on ONYXKEYS.COLLECTION.REPORT_METADATA of the report to determine whether a member is pending deletion.
    const pendingAction = pendingChatMember?.pendingAction ?? reportParticipants?.[accountID]?.pendingAction;

    Therefore, if in successData the ONYXKEYS.COLLECTION.REPORT_METADATA is merged earlier than ONYXKEYS.COLLECTION.REPORT, the deletion state is removed and causes a flash.

    What changes do you think we should make in order to solve the problem?

    We should adopt the same behavior as when deleting a transaction: if offline, the deleted item should be displayed in a pending deletion state; otherwise, we should not render it.

    const pendingAction = pendingChatMember?.pendingAction ?? reportParticipants?.[accountID]?.pendingAction;

    const pendingAction = pendingChatMember?.pendingAction ?? reportParticipants?.[accountID]?.pendingAction;
    if (!isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
        continue;
    }
    

    We also need to apply this change to similar pages.

    What alternative solutions did you explore? (Optional)

    N/A

  5. abbasifaizan70 commented on Jan 13, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When removing members from group chats or custom rooms, the removed members briefly reappear before disappearing permanently.

    What is the root cause of that problem?

    The issue is in the removeFromRoom function where optimistic data only updates pendingChatMembers metadata but doesn't actually remove participants from report.participants:

    App/src/libs/actions/Report.ts

    Lines 4096 to 4104 in 93c20db

    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers,
    },
    },
    ];

    When openRoomMembersPage() is called and returns stale data from the server (before the removal is processed), it overwrites report.participants with the original members, causing them to flash back. The participants are only removed in the success data:

    App/src/libs/actions/Report.ts

    Lines 4480 to 4484 in 93c20db

    function openRoomMembersPage(reportID: string) {
    const parameters: OpenRoomMembersPageParams = {reportID};
    API.read(READ_COMMANDS.OPEN_ROOM_MEMBERS_PAGE, parameters);
    }

    The same issue exists in removeOptimisticRoomMembers function used for workspace room member removal:

    function removeOptimisticRoomMembers(
    roomType: typeof CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE | typeof CONST.REPORT.CHAT_TYPE.POLICY_ADMINS,
    policyID: string | undefined,
    accountIDs: number[],
    ): OnyxDataReturnType {
    const roomMembers: OnyxDataReturnType = {
    optimisticData: [],
    failureData: [],
    successData: [],
    };
    if (!policyID) {
    return roomMembers;
    }
    const report = ReportUtils.getRoom(roomType, policyID);
    const reportMetadata = ReportUtils.getReportMetadata(report?.reportID);
    if (!report) {
    return roomMembers;
    }
    const pendingChatMembers = ReportUtils.getPendingChatMembers(accountIDs, reportMetadata?.pendingChatMembers ?? [], CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
    roomMembers.optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
    value: {
    pendingChatMembers,
    },
    });
    roomMembers.failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
    value: {
    pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
    },
    });
    roomMembers.successData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
    value: {
    pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
    },
    });
    return roomMembers;
    }

    What changes do you think we should make in order to solve the problem?

    Optimistically remove participants from report.participants in addition to updating pendingChatMembers, and restore them in failure data if the removal fails.

    File 1: App/src/libs/actions/Report.ts

    App/src/libs/actions/Report.ts

    Lines 4096 to 4114 in 93c20db

    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers,
    },
    },
    ];
    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
    value: {
    pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
    },
    },
    ];

    // After
    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
            value: {
                participants: removeParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
            value: {
                pendingChatMembers,
            },
        },
    ];
    
    const restoreParticipantsData: Participants = {};
    for (const accountID of targetAccountIDs) {
        restoreParticipantsData[accountID] = report.participants?.[accountID] ?? {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS};
    }
    
    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_METADATA>> = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
            value: {
                participants: restoreParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
            value: {
                pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
            },
        },
    ];

    File 2: App/src/libs/actions/Policy/Member.ts

    Apply the same fix to removeOptimisticRoomMembers function:

    https://github.com/Expensify/App/blob/main/src/libs/actions/Policy/Member.ts#L237-L257

    // Add participants removal to optimistic, failure, and success data
    const removeParticipantsData: Record<number, null> = {};
    for (const accountID of accountIDs) {
        removeParticipantsData[accountID] = null;
    }
    
    roomMembers.optimisticData.push(
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`,
            value: {
                participants: removeParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
            value: {
                pendingChatMembers,
            },
        },
    );
    
    const restoreParticipantsData: Participants = {};
    for (const accountID of accountIDs) {
        restoreParticipantsData[accountID] = report.participants?.[accountID] ?? {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS};
    }
    
    roomMembers.failureData.push(
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`,
            value: {
                participants: restoreParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
            value: {
                pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
            },
        },
    );
    
    roomMembers.successData.push(
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`,
            value: {
                participants: removeParticipantsData,
            },
        },
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report.reportID}`,
            value: {
                pendingChatMembers: reportMetadata?.pendingChatMembers ?? null,
            },
        },
    );

    Also add Participants to imports in App/src/libs/actions/Policy/Member.ts:

    https://github.com/Expensify/App/blob/main/src/libs/actions/Policy/Member.ts#L35

    import type {NotificationPreference, Participant, Participants} from '@src/types/onyx/Report';

    Demo

    Screen.Recording.2026-01-13.at.3.35.44.PM.mov
  6. annaweber830 commented on Jan 13, 2026

    @annaweber830
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-01-14 19:10:45 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When removing members from a group chat or custom room, the removed members briefly reappear in the members list (a visible “flash”), which makes it look like the removal didn’t work and creates UI confusion across platforms.

    What is the root cause of that problem?

    The list UI uses SelectionListWithModal, which decides it’s “filtering” whenever the new data array is shorter than the previous debounced array. Member removal also makes the list shorter, so the component briefly renders the previous debounced list (which still includes the removed member), causing the flash.

    What changes do you think we should make in order to solve the problem?

    Make SelectionListWithModal debounce behavior explicit, so it only shows debouncedData when the user is actually searching/filtering, not when data changes due to removals.

    • Add a new optional prop to SelectionListWithModal, e.g. isFiltering?: boolean (or shouldUseDebouncedData?: boolean).
    • Update SelectionListWithModal logic:
      • If isFiltering === true: render debouncedData
      • Else: render current data immediately
    • Pass the prop from callers:
      • ReportParticipantsPage: isFiltering={!!searchValue.trim()}
      • RoomMembersPage: isFiltering={!!searchValue.trim()}
        This keeps the debounce protection during search (the original reason it exists), but prevents stale “old list” rendering during member removal.
        const isFiltering = data.length < debouncedData.length;

        const isFiltering = isFilteringProp !== undefined ? isFilteringProp : data.length < debouncedData.length;
        type SelectionListWithModalProps<TItem extends ListItem> = SelectionListProps<TItem> & {
        turnOnSelectionModeOnLongPress?: boolean;
        onTurnOnSelectionMode?: (item: TItem | null) => void;
        ref?: ForwardedRef<SelectionListHandle<TItem>>;
        };
    type SelectionListWithModalProps<TItem extends ListItem> = SelectionListProps<TItem> & {
        turnOnSelectionModeOnLongPress?: boolean;
        onTurnOnSelectionMode?: (item: TItem | null) => void;
        isFiltering?: boolean;
        ref?: ForwardedRef<SelectionListHandle<TItem>>;
    };
    function SelectionListWithModal<TItem extends ListItem>({
        turnOnSelectionModeOnLongPress,
        onTurnOnSelectionMode,
        onLongPressRow,
        data,
        isFiltering: isFilteringProp,
        isSelected,
        selectedItems: selectedItemsProp,
        ref,
        ...rest
    }:
    

    <SelectionListWithModal
    data={participants}
    ref={selectionListRef}
    ListItem={TableListItem}
    onSelectRow={openMemberDetails}
    textInputOptions={textInputOptions}
    canSelectMultiple={canSelectMultiple}
    turnOnSelectionModeOnLongPress={isCurrentUserGroupChatAdmin}
    shouldSingleExecuteRowSelect={!isCurrentUserGroupChatAdmin}
    onTurnOnSelectionMode={(item) => item && toggleUser(item)}
    style={{listHeaderWrapperStyle: [styles.ph9, styles.mt3]}}
    onSelectAll={() => toggleAllUsers(participants)}
    onCheckboxPress={toggleUser}
    shouldShowTextInput={shouldShowTextInput}
    customListHeader={customListHeader}
    showScrollIndicator
    />

    <SelectionListWithModal
                            data={participants}
                            isFiltering={!!searchValue.trim()}
                            ref={selectionListRef}
                            ListItem={TableListItem}
                            onSelectRow={openMemberDetails}
                            textInputOptions={textInputOptions}
                            canSelectMultiple={canSelectMultiple}
                            turnOnSelectionModeOnLongPress={isCurrentUserGroupChatAdmin}
                            shouldSingleExecuteRowSelect={!isCurrentUserGroupChatAdmin}
                            onTurnOnSelectionMode={(item) => item && toggleUser(item)}
                            style={{listHeaderWrapperStyle: [styles.ph9, styles.mt3]}}
                            onSelectAll={() => toggleAllUsers(participants)}
                            onCheckboxPress={toggleUser}
                            shouldShowTextInput={shouldShowTextInput}
                            customListHeader={customListHeader}
                            showScrollIndicator
                        />
    

    <SelectionListWithModal
    data={data}
    disableKeyboardShortcuts={removeMembersConfirmModalVisible}
    ListItem={TableListItem}
    onSelectRow={openRoomMemberDetails}
    onCheckboxPress={toggleUser}
    textInputOptions={textInputOptions}
    shouldShowTextInput={shouldShowTextInput}
    showLoadingPlaceholder={!isPersonalDetailsReady(personalDetails) || !didLoadRoomMembers}
    shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
    onTurnOnSelectionMode={(item) => item && toggleUser(item)}
    style={{listHeaderWrapperStyle: [styles.ph9, styles.mt3]}}
    onSelectAll={() => toggleAllUsers(data)}
    canSelectMultiple={canSelectMultiple}
    customListHeader={customListHeader}
    onDismissError={dismissError}
    turnOnSelectionModeOnLongPress
    />

    <SelectionListWithModal
                            data={data}
                            isFiltering={!!searchValue.trim()}
                            disableKeyboardShortcuts={removeMembersConfirmModalVisible}
                            ListItem={TableListItem}
                            onSelectRow={openRoomMemberDetails}
                            onCheckboxPress={toggleUser}
                            textInputOptions={textInputOptions}
                            shouldShowTextInput={shouldShowTextInput}
                            showLoadingPlaceholder={!isPersonalDetailsReady(personalDetails) || !didLoadRoomMembers}
                            shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
                            onTurnOnSelectionMode={(item) => item && toggleUser(item)}
                            style={{listHeaderWrapperStyle: [styles.ph9, styles.mt3]}}
                            onSelectAll={() => toggleAllUsers(data)}
                            canSelectMultiple={canSelectMultiple}
                            customListHeader={customListHeader}
                            onDismissError={dismissError}
                            turnOnSelectionModeOnLongPress
                        />
    

    What alternative solutions did you explore? (Optional)

  7. nkdengineer commented on Jan 14, 2026

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Removed members re-appears in flash.
    Same behavior when remove member from custom room

    What is the root cause of that problem?

    After the API is done, the participants length is reduced (the pending members are removed from this list)

    const [, debouncedData, setDataState] = useDebouncedState<TItem[]>(data, CONST.TIMING.SEARCH_OPTION_LIST_DEBOUNCE_TIME);
    // Determine if this is changed by filtering (to limit multiple rerenders)
    const isFiltering = data.length < debouncedData.length;
    useEffect(() => {
    setDataState(data);
    }, [data, setDataState]);
    const displayData = isFiltering ? debouncedData : data;
    const selectedItems = useMemo(
    () =>

    This causes isFiltering to be true, and the debouncedData is displayed briefly again before debouncedData is updated to data

    data={participants}

    What changes do you think we should make in order to solve the problem?

    We can calculate the default participants without a search value, and pass it to SelectionListWithModal

    const getDefaultParticipants = () => {
            let result: MemberOption[] = [];
    
            for (const accountID of chatParticipants) {
                const role = reportParticipants?.[accountID].role;
                const details = personalDetails?.[accountID];
    
                // If search value is provided, filter out members that don't match the search value
                if (!details) {
                    continue;
                }
    
                const pendingChatMember = pendingChatMembers?.findLast((member) => member.accountID === accountID.toString());
                const isSelected = selectedMembers.includes(accountID) && canSelectMultiple;
                const isAdmin = role === CONST.REPORT.ROLE.ADMIN;
                let roleBadge = null;
                if (isAdmin) {
                    roleBadge = <Badge text={translate('common.admin')} />;
                }
    
                const pendingAction = pendingChatMember?.pendingAction ?? reportParticipants?.[accountID]?.pendingAction;
    
                result.push({
                    keyForList: `${accountID}`,
                    accountID,
                    isSelected,
                    isDisabledCheckbox: accountID === currentUserAccountID,
                    isDisabled: pendingChatMember?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || details?.isOptimisticPersonalDetail,
                    text: formatPhoneNumber(getDisplayNameOrDefault(details)),
                    alternateText: formatPhoneNumber(details?.login ?? ''),
                    rightElement: roleBadge,
                    pendingAction,
                    icons: [
                        {
                            source: details?.avatar ?? icons.FallbackAvatar,
                            name: formatPhoneNumber(details?.login ?? ''),
                            type: CONST.ICON_TYPE_AVATAR,
                            id: accountID,
                        },
                    ],
                });
            }
    
            result = result.sort((a, b) => localeCompare((a.text ?? '').toLowerCase(), (b.text ?? '').toLowerCase()));
            return result;
        }
    const defaultParticipants = getDefaultParticipants();
    defaultData={defaultParticipants}
    

    const getParticipants = () => {

    And then update isFiltering condition to compare the length of the current data with the original data instead.

    const isFiltering = data.length < defaultData?.length;
    

    const [, debouncedData, setDataState] = useDebouncedState<TItem[]>(data, CONST.TIMING.SEARCH_OPTION_LIST_DEBOUNCE_TIME);
    // Determine if this is changed by filtering (to limit multiple rerenders)
    const isFiltering = data.length < debouncedData.length;
    useEffect(() => {
    setDataState(data);
    }, [data, setDataState]);
    const displayData = isFiltering ? debouncedData : data;
    const selectedItems = useMemo(
    () =>

    What alternative solutions did you explore? (Optional)

    We can pass isFiltering as a prop of SelectionListWithModal instead of comparing like this. For example, in this page we will pass isFiltering={!!searchValue}

    const [, debouncedData, setDataState] = useDebouncedState<TItem[]>(data, CONST.TIMING.SEARCH_OPTION_LIST_DEBOUNCE_TIME);
    // Determine if this is changed by filtering (to limit multiple rerenders)
    const isFiltering = data.length < debouncedData.length;
    useEffect(() => {
    setDataState(data);
    }, [data, setDataState]);
    const displayData = isFiltering ? debouncedData : data;
    const selectedItems = useMemo(
    () =>

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 14, 2026
  9. changed the title [-]Group - Group chat members reappears when remove from group[/-] [+][$250] Group - Group chat members reappears when remove from group[/+] on Jan 14, 2026
  10. melvin-bot commented on Jan 14, 2026

    @melvin-bot
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 14, 2026
  12. 49 remaining items

  13. melvin-bot commented on Feb 26, 2026

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  14. garrettmknight commented on Feb 26, 2026

    @garrettmknight
    Contributor

    @RachCHopkins can you create the QA issue and update the payment summary once the checklist is complete? Thanks!

  15. garrettmknight commented on Feb 26, 2026

    @garrettmknight
    Contributor

    @eh2077 bump on the checklist.

  16. MelvinBot commented on Feb 26, 2026

    @MelvinBot
    Contributor

    🔍 Issue Analysis

    Summary: When removing members from a group chat or custom room, the removed members briefly reappear ("flash") before disappearing. PR #80324 was merged to fix this for ReportParticipantsPage, but the fix may be incomplete for RoomMembersPage.

    Root Cause: Two contributing factors combine to produce the flash:

    1. Primary — successData race condition: In removeFromRoom the successData updates two different Onyx keys (REPORT and REPORT_METADATA) via Promise.all. When REPORT_METADATA subscribers fire first, pendingChatMembers is cleared while report.participants still contains the removed member — creating a window where the member has no pending-delete flag and passes all filters.

    2. Secondary — SelectionListWithModal debounce: The isFiltering heuristic (filteredData.length < debouncedData.length) incorrectly treats the shorter list from member removal as "filtering," causing displayData to use stale debouncedData for up to 300ms.

    Applied Fix (PR #80324): Added a continue in ReportParticipantsPage.tsx:228-230 to skip rendering members with pendingAction === DELETE when online. This prevents the flash for group chat member pages.

    Potential Gap: RoomMembersPage.tsx (custom rooms) does NOT have the equivalent page-level skip. It relies on SelectionListWithModal's filteredData pre-filter (line 51), which filters items with pendingAction === DELETE. However, during the race condition window, the member arrives at the component without pendingAction=DELETE (because pendingChatMembers was already cleared), so this filter is bypassed. The issue description explicitly mentions "Same behavior when remove member from custom room."

    Detailed Investigation

    Mechanism

    1. User removes member → removeFromRoom() sets pendingChatMembers with DELETE action on REPORT_METADATA (optimistic data). Member is hidden via page-level and component-level filters.
    2. API succeeds → successData queues two separate Onyx merges: REPORT (sets participants[accountID] = null) and REPORT_METADATA (clears pendingChatMembers).
    3. Onyx processes these as separate merge() calls in Promise.all — they notify subscribers independently.
    4. If REPORT_METADATA fires first: pendingChatMembers cleared → member no longer has DELETE pending action → passes all filters → flash.
    5. Shortly after, REPORT fires → participants[accountID] = null → member finally removed.
    6. SelectionListWithModal debounce extends the flash up to 300ms via isFiltering heuristic.

    Evidence Chain

    • Optimistic data only touches REPORT_METADATA, not report.participants — src/libs/actions/Report/index.ts:4430-4438
    • Success data has separate REPORT and REPORT_METADATA updates — src/libs/actions/Report/index.ts:4452-4467
    • Onyx update() processes different keys as separate Promise.all entries — node_modules/react-native-onyx/dist/Onyx.js:488-501
    • ReportParticipantsPage now skips DELETE members when online (PR Fix/79430 - Group chat members reappears when remove from group #80324 fix) — src/pages/ReportParticipantsPage.tsx:228-230
    • RoomMembersPage does NOT skip DELETE members at page level — src/pages/RoomMembersPage.tsx:286-311
    • SelectionListWithModal has filteredData pre-filter but it's bypassed during the race window — src/components/SelectionListWithModal/index.tsx:50-51

    Relevant Code

    • src/libs/actions/Report/index.ts:4430-4467 — optimistic and success data for removeFromRoom
    • src/pages/ReportParticipantsPage.tsx:228-230 — page-level fix from PR Fix/79430 - Group chat members reappears when remove from group #80324
    • src/pages/RoomMembersPage.tsx:286-311 — member list builder (missing equivalent fix)
    • src/components/SelectionListWithModal/index.tsx:49-67 — filteredData, debounce, and isFiltering logic

    Next Steps for Contributor+ team: The merged PR #80324 fixes the flash on ReportParticipantsPage (group chats). Verify whether the same flash still occurs on RoomMembersPage (custom rooms) — if so, apply the equivalent !isOffline && pendingAction === DELETE → continue fix there as well. Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  17. eh2077 commented on Mar 2, 2026

    @eh2077
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/77948/changes#r2871754209

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/606516

    Regression Test Proposal

    Precondition:

    • NA

    Test:

    1. Create a group chat
    2. Invite a few members
    3. Remove the members
    4. Verify that the members are removed and do not reappear in flash

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-26dc-a69b-a377-c9a36f83a3c4
  18. eh2077 commented on Mar 2, 2026

    @eh2077
    Contributor

    @garrettmknight Checklist done, thanks!

  19. RachCHopkins commented on Mar 3, 2026

    @RachCHopkins
    Contributor

    @garrettmknight can I check that this comment means @dmkt9 has been paid? If not, can someone link me the offer, please?

  20. RachCHopkins commented on Mar 3, 2026

    @RachCHopkins
    Contributor

    Oh I see, Garrett is OOO - @dmkt9 did you get paid? If not, can you link me to the offer please?

  21. dmkt9 commented on Mar 3, 2026

    @dmkt9
    Contributor

    Oh I see, Garrett is OOO - @dmkt9 did you get paid? If not, can you link me to the offer please?

    @RachCHopkins Yes. I got paid already. Thank you.

  22. RachCHopkins commented on Mar 3, 2026

    @RachCHopkins
    Contributor

    Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

    🟢 to @eh2077 to request payment via ND.

  23. JmillsExpensify commented on Mar 13, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @eh2077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions