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 { isInlineCellInEditModeScopedState } from '@/object-record/record-inline-cell/states/isInlineCellInEditModeScopedState';
|
||||
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 { useRecoilCallback } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const useRecordTitleCell = () => {
|
||||
const { goBackToPreviousDropdownFocusId } =
|
||||
useGoBackToPreviousDropdownFocusId();
|
||||
@ -42,8 +45,10 @@ export const useRecordTitleCell = () => {
|
||||
[goBackToPreviousDropdownFocusId, goBackToPreviousHotkeyScope],
|
||||
);
|
||||
|
||||
const initFieldInputDraftValue = useInitDraftValueV2();
|
||||
|
||||
const openRecordTitleCell = useRecoilCallback(
|
||||
({ set }) =>
|
||||
({ set, snapshot }) =>
|
||||
({
|
||||
recordId,
|
||||
fieldMetadataId,
|
||||
@ -55,13 +60,6 @@ export const useRecordTitleCell = () => {
|
||||
containerType: RecordTitleCellContainerType;
|
||||
customEditHotkeyScopeForField?: HotkeyScope;
|
||||
}) => {
|
||||
set(
|
||||
isInlineCellInEditModeScopedState(
|
||||
getRecordTitleCellId(recordId, fieldMetadataId, containerType),
|
||||
),
|
||||
true,
|
||||
);
|
||||
|
||||
if (isDefined(customEditHotkeyScopeForField)) {
|
||||
setHotkeyScopeAndMemorizePreviousScope(
|
||||
customEditHotkeyScopeForField.scope,
|
||||
@ -72,8 +70,33 @@ export const useRecordTitleCell = () => {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user