diff --git a/src/components/Table/useMenuAction.tsx b/src/components/Table/useMenuAction.tsx index 516124d3..a2d84b05 100644 --- a/src/components/Table/useMenuAction.tsx +++ b/src/components/Table/useMenuAction.tsx @@ -25,6 +25,8 @@ const SUPPORTED_TYPES = new Set([ FieldType.richText, FieldType.url, FieldType.json, + FieldType.singleSelect, + FieldType.multiSelect, ]); export function useMenuAction( @@ -136,14 +138,22 @@ export function useMenuAction( const checkEnabled = useCallback( (func: Function) => { + if (!selectedCol) { + return function () { + enqueueSnackbar(`No selected cell`, { + variant: "error", + }); + }; + } + const fieldType = getFieldType(selectedCol); return function () { - if (SUPPORTED_TYPES.has(selectedCol?.type)) { + if (SUPPORTED_TYPES.has(fieldType)) { return func(); } else { enqueueSnackbar( - `${selectedCol?.type} field cannot be copied using keyboard shortcut`, + `${fieldType} field cannot be copied using keyboard shortcut`, { - variant: "info", + variant: "error", } ); } diff --git a/src/components/fields/SingleSelect/index.tsx b/src/components/fields/SingleSelect/index.tsx index 83a23e3e..468d7f01 100644 --- a/src/components/fields/SingleSelect/index.tsx +++ b/src/components/fields/SingleSelect/index.tsx @@ -21,7 +21,7 @@ export const config: IFieldConfig = { type: FieldType.singleSelect, name: "Single Select", group: "Select", - dataType: "string | null", + dataType: "string", initialValue: null, initializable: true, icon: ,