Skip to content

Commit

Permalink
fix: filtered fields are deleted (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-w authored Jul 29, 2024
1 parent ecad6fe commit d6c2f05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IBaseOperatorSelectProps {
export function BaseOperatorSelect(props: IBaseOperatorSelectProps) {
const { onSelect, value, field } = props;
const compact = useCompact();
const labelMapping = useOperatorI18nMap(field!);
const labelMapping = useOperatorI18nMap(field);

const operatorOption = useMemo<IOperatorOptions[]>(() => {
if (field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FieldType } from '@teable/core';
import { useTranslation } from '../../../context/app/i18n';
import type { IFieldInstance } from '../../../model';

export const useOperatorI18nMap = (field: IFieldInstance) => {
export const useOperatorI18nMap = (field?: IFieldInstance) => {
const { t } = useTranslation();
const commonMap = {
is: t('filter.operator.is'),
Expand All @@ -27,7 +27,7 @@ export const useOperatorI18nMap = (field: IFieldInstance) => {
isOnOrBefore: t('filter.operator.isOnOrBefore'),
isOnOrAfter: t('filter.operator.isOnOrAfter'),
};
if (field.type === FieldType.Number) {
if (field?.type === FieldType.Number) {
return {
...commonMap,
is: t('filter.operator.number.is'),
Expand Down

0 comments on commit d6c2f05

Please sign in to comment.