Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)

* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
Lucas Bordeau
2024-03-11 14:28:57 +01:00
committed by GitHub
parent 3f15cc5b7a
commit 581dfafe11
169 changed files with 469 additions and 493 deletions

View File

@ -12,8 +12,8 @@ import { isNonEmptyString } from '@sniptt/guards';
import { Button } from '@/ui/input/button/components/Button';
import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
import { isNonNullable } from '~/utils/isNonNullable';
import { isNullable } from '~/utils/isNullable';
import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
import { AttachmentIcon } from '../files/components/AttachmentIcon';
import { AttachmentType } from '../files/types/Attachment';
@ -80,7 +80,7 @@ const FileBlockRenderer = ({
const inputFileRef = useRef<HTMLInputElement>(null);
const handleUploadAttachment = async (file: File) => {
if (isNullable(file)) {
if (isUndefinedOrNull(file)) {
return '';
}
const fileUrl = await editor.uploadFile?.(file);
@ -96,8 +96,7 @@ const FileBlockRenderer = ({
inputFileRef?.current?.click?.();
};
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
if (isNonNullable(e.target.files))
handleUploadAttachment?.(e.target.files[0]);
if (isDefined(e.target.files)) handleUploadAttachment?.(e.target.files[0]);
};
if (isNonEmptyString(block.props.url)) {