Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { RawData } from '@/spreadsheet-import/types';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { Column } from '../MatchColumnsStep';
|
||||
|
||||
@ -39,7 +39,7 @@ export const UserTableColumn = <T extends string>({
|
||||
entries,
|
||||
}: UserTableColumnProps<T>) => {
|
||||
const { header } = column;
|
||||
const entry = entries.find(isNonNullable);
|
||||
const entry = entries.find(isDefined);
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
|
||||
@ -14,7 +14,7 @@ import { useDialogManager } from '@/ui/feedback/dialog-manager/hooks/useDialogMa
|
||||
import { Button } from '@/ui/input/button/components/Button';
|
||||
import { Toggle } from '@/ui/input/components/Toggle';
|
||||
import { Modal } from '@/ui/layout/modal/components/Modal';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { generateColumns } from './components/columns';
|
||||
import { Meta } from './types';
|
||||
@ -130,7 +130,7 @@ export const ValidationStep = <T extends string>({
|
||||
const tableData = useMemo(() => {
|
||||
if (filterByErrors) {
|
||||
return data.filter((value) => {
|
||||
if (isNonNullable(value?.__errors)) {
|
||||
if (isDefined(value?.__errors)) {
|
||||
return Object.values(value.__errors)?.filter(
|
||||
(err) => err.level === 'error',
|
||||
).length;
|
||||
@ -147,7 +147,7 @@ export const ValidationStep = <T extends string>({
|
||||
const calculatedData = data.reduce(
|
||||
(acc, value) => {
|
||||
const { __index, __errors, ...values } = value;
|
||||
if (isNonNullable(__errors)) {
|
||||
if (isDefined(__errors)) {
|
||||
for (const key in __errors) {
|
||||
if (__errors[key].level === 'error') {
|
||||
acc.invalidData.push(values as unknown as Data<T>);
|
||||
@ -166,7 +166,7 @@ export const ValidationStep = <T extends string>({
|
||||
};
|
||||
const onContinue = () => {
|
||||
const invalidData = data.find((value) => {
|
||||
if (isNonNullable(value?.__errors)) {
|
||||
if (isDefined(value?.__errors)) {
|
||||
return !!Object.values(value.__errors)?.filter(
|
||||
(err) => err.level === 'error',
|
||||
).length;
|
||||
|
||||
@ -9,7 +9,7 @@ import { AppTooltip } from '@/ui/display/tooltip/AppTooltip';
|
||||
import { Checkbox, CheckboxVariant } from '@/ui/input/components/Checkbox';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { Toggle } from '@/ui/input/components/Toggle';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { Meta } from '../types';
|
||||
|
||||
@ -208,7 +208,7 @@ export const generateColumns = <T extends string>(
|
||||
);
|
||||
}
|
||||
|
||||
if (isNonNullable(row.__errors?.[columnKey])) {
|
||||
if (isDefined(row.__errors?.[columnKey])) {
|
||||
return (
|
||||
<>
|
||||
{component}
|
||||
|
||||
Reference in New Issue
Block a user