Make filters and sorts work on record page pagination (#12460)

Fixes #7929 

This PR implements a system to capture and preserve the filters and
sorts when navigating from an index view to a record show page. This
information is stored in a context store component state.

This allows users to navigate between records inside the record page
while maintaining context from the index view.
This commit is contained in:
Raphaël Bosi
2025-06-11 18:01:03 +02:00
committed by GitHub
parent 23cbeec227
commit 27d0a3766f
18 changed files with 296 additions and 195 deletions

View File

@ -7,6 +7,7 @@ import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { MouseEvent } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
import {
AvatarChip,
AvatarChipVariant,
@ -27,6 +28,7 @@ export type RecordChipProps = {
size?: ChipSize;
isLabelHidden?: boolean;
triggerEvent?: TriggerEventType;
onClick?: (event: MouseEvent) => void;
};
export const RecordChip = ({
@ -40,6 +42,7 @@ export const RecordChip = ({
forceDisableClick = false,
isLabelHidden = false,
triggerEvent = 'MOUSE_DOWN',
onClick,
}: RecordChipProps) => {
const { recordChipData } = useRecordChipData({
objectNameSingular,
@ -53,14 +56,16 @@ export const RecordChip = ({
const isSidePanelViewOpenRecordInType =
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL;
const handleCustomClick = isSidePanelViewOpenRecordInType
? (_event: MouseEvent<HTMLElement>) => {
openRecordInCommandMenu({
recordId: record.id,
objectNameSingular,
});
}
: undefined;
const handleCustomClick = isDefined(onClick)
? onClick
: isSidePanelViewOpenRecordInType
? (_event: MouseEvent<HTMLElement>) => {
openRecordInCommandMenu({
recordId: record.id,
objectNameSingular,
});
}
: undefined;
// TODO temporary until we create a record show page for Workspaces members