Fix workflow title cell not opening (#13052)
This PR fixes a bug that forced all title cell to behave as if they were in a show page, but we have workflow page breadcrumb that is not a show page title. Fixes https://github.com/twentyhq/twenty/issues/13041
This commit is contained in:
@ -97,6 +97,7 @@ export const RecordTitleCell = ({
|
|||||||
editModeContentOnly: isFieldInputOnly,
|
editModeContentOnly: isFieldInputOnly,
|
||||||
loading: loading,
|
loading: loading,
|
||||||
isReadOnly,
|
isReadOnly,
|
||||||
|
containerType,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
|
||||||
import { createContext, ReactElement } from 'react';
|
import { createContext, ReactElement } from 'react';
|
||||||
|
|
||||||
export type RecordTitleCellContextProps = {
|
export type RecordTitleCellContextProps = {
|
||||||
@ -6,15 +7,8 @@ export type RecordTitleCellContextProps = {
|
|||||||
displayModeContent?: ReactElement;
|
displayModeContent?: ReactElement;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
isReadOnly?: boolean;
|
isReadOnly?: boolean;
|
||||||
};
|
containerType: RecordTitleCellContainerType;
|
||||||
|
|
||||||
const defaultRecordTitleCellContextProp: RecordTitleCellContextProps = {
|
|
||||||
editModeContent: undefined,
|
|
||||||
editModeContentOnly: false,
|
|
||||||
displayModeContent: undefined,
|
|
||||||
loading: false,
|
|
||||||
isReadOnly: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RecordTitleCellContext =
|
export const RecordTitleCellContext =
|
||||||
createContext<RecordTitleCellContextProps>(defaultRecordTitleCellContextProp);
|
createContext<RecordTitleCellContextProps>({} as RecordTitleCellContextProps);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||||
|
import { RecordTitleCellContext } from '@/object-record/record-title-cell/components/RecordTitleCellContext';
|
||||||
import { useRecordTitleCell } from '@/object-record/record-title-cell/hooks/useRecordTitleCell';
|
import { useRecordTitleCell } from '@/object-record/record-title-cell/hooks/useRecordTitleCell';
|
||||||
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
|
|
||||||
import { Theme, withTheme } from '@emotion/react';
|
import { Theme, withTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
@ -40,13 +40,15 @@ export const RecordTitleCellSingleTextDisplayMode = () => {
|
|||||||
|
|
||||||
const { openRecordTitleCell } = useRecordTitleCell();
|
const { openRecordTitleCell } = useRecordTitleCell();
|
||||||
|
|
||||||
|
const { containerType } = useContext(RecordTitleCellContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDiv
|
<StyledDiv
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
openRecordTitleCell({
|
openRecordTitleCell({
|
||||||
recordId,
|
recordId,
|
||||||
fieldMetadataId: fieldDefinition.fieldMetadataId,
|
fieldMetadataId: fieldDefinition.fieldMetadataId,
|
||||||
containerType: RecordTitleCellContainerType.ShowPage,
|
containerType,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user