#26827·twenty

Front components opened in the side panel only get one selected record: `useSelectedRecordIds()` returns `[]` when 2+ records are selected

Author: MikeI-CodeCreated Sep 28, 2026Updated Sep 28, 2026
Labelstype: bug

A front component launched from a command menu item opens in the side panel. When that happens, useSelectedRecordIds() only works if exactly one record is selected. With 2 or more records selected, it returns an empty array, even though the host knows about the selection: the header shows "N selected" and the command menu shows "Selection: N People".

The multi-record selection is dropped before the component starts, so no change on the app side can fix it.

Steps to reproduce

  1. Make an app with a non-headless front component, attached to a command menu item on the person object:
    typescript
    import { useSelectedRecordIds } from 'twenty-sdk/front-component';
    export default () => {
      const ids = useSelectedRecordIds();
      return <div>Selected: {ids.length}</div>;
    };
  2. On the People table view, select one row, open the command menu and run the command. It shows Selected: 1 ✅
  3. Select two or more rows and run the command again. It shows Selected: 0 ❌

Expected behavior

useSelectedRecordIds() returns every selected record ID, as its type says ("All selected record IDs").

Actual behavior

  • 1 record selected: [id]
  • 2+ records selected: []

useRecordId() behaves as expected: it returns null when 2+ records are selected. useSelectedRecordIds() should return the full list, but it also comes back empty.

Root cause (from inspecting the running app)

The host builds the execution context correctly (selectedRecordIds: selectedRecordIds ?? []), but the side-panel page that renders the component only passes on a single record ID. Here is the relevant logic, un-minified from the production bundle:

javascript
const frontComponentId = useAtomValue(viewableFrontComponentIdState);
const recordContext = useAtomValue(viewableFrontComponentRecordContextState); // { objectNameSingular, recordId? }
const selectedRecordIds = isDefined(recordContext?.recordId) ? [recordContext.recordId] : undefined;

With 2+ records selected, the stored record context is only { objectNameSingular: "person" }, so selectedRecordIds ends up undefined and then []. At that moment, the command menu context holds the full selection (numberOfSelectedRecords: 2, selectedRecords: [...]).

The SDK types have the same limit. The SidePanelPages.ViewFrontComponent params only accept recordId?: string, with nothing for multiple IDs.

Suggested fix

Store the full selection (for example selectedRecordIds: string[], or the targeted-records rule for select-all) in the side-panel front component record context, and add it to the ViewFrontComponent page params.

Environment

  • Twenty: self-hosted, reproduced on v2.39.1 and v2.43.0
  • twenty-sdk: 2.37.0 and 2.39.0 (same result on both)
  • Browser: Chrome (latest), also reproduced in a clean incognito window with no extensions
  • Console / network: no errors and no failed requests

Impact

Bulk actions built as front components can't work from multi-select, for example "Add selected people to a list". The only workarounds are processing one record at a time, or passing IDs out of band from a headless launcher.