Fix broken chips on timelin eActivity on show pages (#9057)

We were using RecordIndexContext in FieldDisplays components which is
wrong as the FieldDisplays could be used in locations not providing this
context (not being indexes pages).

Instead, we are passing it within FieldContext which the context that
will always be there for FieldDisplays and we need indexes to fill this
FieldContext with their RecordIndexContext value when needed
This commit is contained in:
Charles Bochet
2024-12-13 15:34:00 +01:00
committed by GitHub
parent 257834ea71
commit 57869d3c8c
12 changed files with 21 additions and 29 deletions

View File

@ -128,7 +128,6 @@ export const getFieldDecorator =
<FieldContext.Provider
value={{
recordId: record.id,
basePathToShowPage: '/object-record/',
isLabelIdentifier,
fieldDefinition: formatFieldMetadataItemAsColumnDefinition({
field: fieldMetadataItem,

View File

@ -2,7 +2,6 @@ import { ReactNode } from 'react';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition';
import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
import {
FieldContext,
RecordUpdateHook,
@ -30,10 +29,6 @@ export const useMockFieldContext = ({
objectNameSingular,
});
const basePathToShowPage = getBasePathToShowPage({
objectNameSingular,
});
const fieldMetadataItem = objectMetadataItem?.fields.find(
(field) => field.name === fieldMetadataName,
);
@ -50,9 +45,6 @@ export const useMockFieldContext = ({
<FieldContext.Provider
key={objectRecordId + fieldMetadataItem.id}
value={{
basePathToShowPage: isLabelIdentifier
? basePathToShowPage
: undefined,
recordId: objectRecordId,
recoilScopeId: objectRecordId + fieldMetadataItem.id,
isLabelIdentifier,