Fixed sync between record value context selector and record store (#5517)

This PR introduces many improvements over the new profiling story
feature, with new tests and some refactor with main :
- Added use-context-selector for getting value faster in display fields
and created useRecordFieldValue() hook and RecordValueSetterEffect to
synchronize states
- Added performance test command in CI
- Refactored ExpandableList drill-downs with FieldFocusContext
- Refactored field button icon logic into getFieldButtonIcon util
- Added RelationFieldDisplay perf story
- Added RecordTableCell perf story
- First split test of useField.. hook with useRelationFieldDisplay()
- Fixed problem with set cell soft focus
- Isolated logic between display / soft focus and edit mode in the
related components to optimize performances for display mode.
- Added warmupRound config for performance story decorator
- Added variance in test reporting
This commit is contained in:
Lucas Bordeau
2024-05-24 16:52:05 +02:00
committed by GitHub
parent 82ec30c957
commit de9321dcd9
47 changed files with 2043 additions and 554 deletions

View File

@ -1,10 +1,7 @@
import { MouseEventHandler, useMemo } from 'react';
import { FieldLinksValue } from '@/object-record/record-field/types/FieldMetadata';
import {
ExpandableList,
ExpandableListProps,
} from '@/ui/layout/expandable-list/components/ExpandableList';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import { RoundedLink } from '@/ui/navigation/link/components/RoundedLink';
import {
LinkType,
@ -15,18 +12,12 @@ import { isDefined } from '~/utils/isDefined';
import { getAbsoluteUrl } from '~/utils/url/getAbsoluteUrl';
import { getUrlHostName } from '~/utils/url/getUrlHostName';
type LinksDisplayProps = Pick<
ExpandableListProps,
'isChipCountDisplayed' | 'withExpandedListBorder'
> & {
type LinksDisplayProps = {
value?: FieldLinksValue;
isFocused?: boolean;
};
export const LinksDisplay = ({
isChipCountDisplayed,
withExpandedListBorder,
value,
}: LinksDisplayProps) => {
export const LinksDisplay = ({ value, isFocused }: LinksDisplayProps) => {
const links = useMemo(
() =>
[
@ -53,10 +44,7 @@ export const LinksDisplay = ({
const handleClick: MouseEventHandler = (event) => event.stopPropagation();
return (
<ExpandableList
isChipCountDisplayed={isChipCountDisplayed}
withExpandedListBorder={withExpandedListBorder}
>
<ExpandableList isChipCountDisplayed={isFocused}>
{links.map(({ url, label, type }, index) =>
type === LinkType.LinkedIn || type === LinkType.Twitter ? (
<SocialLink key={index} href={url} onClick={handleClick} type={type}>

View File

@ -0,0 +1 @@
export const FIELD_EDIT_BUTTON_WIDTH = 28;