Fixed single record select hotkeys (#9433)
There is a problem of hotkey scope not being passed to the relation picker used for single record select fields. Fixed it where we open a single record select.
This commit is contained in:
@ -6,12 +6,14 @@ import { viewableRecordIdState } from '@/object-record/record-right-drawer/state
|
||||
import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
|
||||
import { SingleRecordSelect } from '@/object-record/relation-picker/components/SingleRecordSelect';
|
||||
import { RecordPickerComponentInstanceContext } from '@/object-record/relation-picker/states/contexts/RecordPickerComponentInstanceContext';
|
||||
import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types/RelationPickerHotkeyScope';
|
||||
import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer';
|
||||
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
import { v4 } from 'uuid';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export const RecordBoardColumnNewOpportunity = ({
|
||||
columnId,
|
||||
position,
|
||||
@ -62,7 +64,7 @@ export const RecordBoardColumnNewOpportunity = ({
|
||||
{newRecord.isCreating && newRecord.position === position && (
|
||||
<OverlayContainer>
|
||||
<RecordPickerComponentInstanceContext.Provider
|
||||
value={{ instanceId: 'relation-picker' }}
|
||||
value={{ instanceId: RelationPickerHotkeyScope.RelationPicker }}
|
||||
>
|
||||
<SingleRecordSelect
|
||||
onCancel={() => handleCreateSuccess(position, columnId, false)}
|
||||
|
||||
@ -21,7 +21,7 @@ export const useAddNewCard = () => {
|
||||
const { createOneRecord, selectFieldMetadataItem, objectMetadataItem } =
|
||||
useContext(RecordBoardContext);
|
||||
const { resetSearchFilter } = useRecordSelectSearch({
|
||||
recordPickerInstanceId: 'record-picker',
|
||||
recordPickerInstanceId: RelationPickerHotkeyScope.RelationPicker,
|
||||
});
|
||||
|
||||
const {
|
||||
|
||||
@ -78,7 +78,7 @@ export const RecordDetailRelationSection = ({
|
||||
|
||||
const relationRecordIds = relationRecords.map(({ id }) => id);
|
||||
|
||||
const dropdownId = `record-field-card-relation-picker-${fieldDefinition.label}-${recordId}`;
|
||||
const dropdownId = `record-field-card-relation-picker-${fieldDefinition.fieldMetadataId}-${recordId}`;
|
||||
|
||||
const { closeDropdown, isDropdownOpen, dropdownPlacement } =
|
||||
useDropdown(dropdownId);
|
||||
@ -138,6 +138,7 @@ export const RecordDetailRelationSection = ({
|
||||
},
|
||||
view: indexView?.id,
|
||||
};
|
||||
|
||||
const filterLinkHref = `/objects/${
|
||||
relationObjectMetadataItem.namePlural
|
||||
}?${qs.stringify(filterQueryParams)}`;
|
||||
|
||||
@ -9,6 +9,7 @@ import { SearchPickerInitialValueEffect } from '@/object-record/relation-picker/
|
||||
import { SingleRecordSelect } from '@/object-record/relation-picker/components/SingleRecordSelect';
|
||||
import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/relation-picker/hooks/useAddNewRecordAndOpenRightDrawer';
|
||||
import { RecordForSelect } from '@/object-record/relation-picker/types/RecordForSelect';
|
||||
import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types/RelationPickerHotkeyScope';
|
||||
|
||||
export type RelationPickerProps = {
|
||||
selectedRecordId?: string;
|
||||
@ -29,7 +30,7 @@ export const RelationPicker = ({
|
||||
initialSearchFilter,
|
||||
fieldDefinition,
|
||||
}: RelationPickerProps) => {
|
||||
const recordPickerInstanceId = 'relation-picker';
|
||||
const recordPickerInstanceId = RelationPickerHotkeyScope.RelationPicker;
|
||||
|
||||
const handleRecordSelected = (
|
||||
selectedRecord: RecordForSelect | null | undefined,
|
||||
|
||||
Reference in New Issue
Block a user