Record name missing when being created from a filter (#11733)
name of record not appearing when being created from a filter Before : <img width="223" alt="Screenshot 2025-04-25 at 10 48 27" src="https://github.com/user-attachments/assets/e3c7cc05-8664-4c14-bcaa-d5b045eb8311" /> After : <img width="236" alt="Screenshot 2025-04-25 at 10 48 53" src="https://github.com/user-attachments/assets/778e02e0-0451-4125-b13e-0c2ac222ef41" />
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
import { useInitDraftValueV2 } from '@/object-record/record-field/hooks/useInitDraftValueV2';
|
||||||
|
import { recordIndexFieldDefinitionsState } from '@/object-record/record-index/states/recordIndexFieldDefinitionsState';
|
||||||
import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
|
import { INLINE_CELL_HOTKEY_SCOPE_MEMOIZE_KEY } from '@/object-record/record-inline-cell/constants/InlineCellHotkeyScopeMemoizeKey';
|
||||||
import { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
|
import { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
|
||||||
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
|
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
|
||||||
@ -8,6 +10,7 @@ import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousH
|
|||||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback } from 'recoil';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
|
||||||
export const useRecordTitleCell = () => {
|
export const useRecordTitleCell = () => {
|
||||||
const { goBackToPreviousDropdownFocusId } =
|
const { goBackToPreviousDropdownFocusId } =
|
||||||
useGoBackToPreviousDropdownFocusId();
|
useGoBackToPreviousDropdownFocusId();
|
||||||
@ -42,8 +45,10 @@ export const useRecordTitleCell = () => {
|
|||||||
[goBackToPreviousDropdownFocusId, goBackToPreviousHotkeyScope],
|
[goBackToPreviousDropdownFocusId, goBackToPreviousHotkeyScope],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const initFieldInputDraftValue = useInitDraftValueV2();
|
||||||
|
|
||||||
const openRecordTitleCell = useRecoilCallback(
|
const openRecordTitleCell = useRecoilCallback(
|
||||||
({ set }) =>
|
({ set, snapshot }) =>
|
||||||
({
|
({
|
||||||
recordId,
|
recordId,
|
||||||
fieldMetadataId,
|
fieldMetadataId,
|
||||||
@ -55,13 +60,6 @@ export const useRecordTitleCell = () => {
|
|||||||
containerType: RecordTitleCellContainerType;
|
containerType: RecordTitleCellContainerType;
|
||||||
customEditHotkeyScopeForField?: HotkeyScope;
|
customEditHotkeyScopeForField?: HotkeyScope;
|
||||||
}) => {
|
}) => {
|
||||||
set(
|
|
||||||
isInlineCellInEditModeScopedState(
|
|
||||||
getRecordTitleCellId(recordId, fieldMetadataId, containerType),
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isDefined(customEditHotkeyScopeForField)) {
|
if (isDefined(customEditHotkeyScopeForField)) {
|
||||||
setHotkeyScopeAndMemorizePreviousScope(
|
setHotkeyScopeAndMemorizePreviousScope(
|
||||||
customEditHotkeyScopeForField.scope,
|
customEditHotkeyScopeForField.scope,
|
||||||
@ -72,8 +70,33 @@ export const useRecordTitleCell = () => {
|
|||||||
TitleInputHotkeyScope.TitleInput,
|
TitleInputHotkeyScope.TitleInput,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const recordTitleCellId = getRecordTitleCellId(
|
||||||
|
recordId,
|
||||||
|
fieldMetadataId,
|
||||||
|
containerType,
|
||||||
|
);
|
||||||
|
set(isInlineCellInEditModeScopedState(recordTitleCellId), true);
|
||||||
|
|
||||||
|
const recordIndexFieldDefinitions = snapshot
|
||||||
|
.getLoadable(recordIndexFieldDefinitionsState)
|
||||||
|
.getValue();
|
||||||
|
|
||||||
|
const fieldDefinition = recordIndexFieldDefinitions.find(
|
||||||
|
(field) => field.fieldMetadataId === fieldMetadataId,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fieldDefinition) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
initFieldInputDraftValue({
|
||||||
|
recordId,
|
||||||
|
fieldDefinition,
|
||||||
|
fieldComponentInstanceId: recordTitleCellId,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[setHotkeyScopeAndMemorizePreviousScope],
|
[initFieldInputDraftValue, setHotkeyScopeAndMemorizePreviousScope],
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user