Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
@ -5,7 +5,7 @@ import { isLabelIdentifierField } from '@/object-metadata/utils/isLabelIdentifie
|
||||
import { SettingsObjectFieldSelectFormValues } from '@/settings/data-model/components/SettingsObjectFieldSelectForm';
|
||||
import { SETTINGS_FIELD_METADATA_TYPES } from '@/settings/data-model/constants/SettingsFieldMetadataTypes';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export const getFieldDefaultPreviewValue = ({
|
||||
fieldMetadataItem,
|
||||
@ -24,7 +24,7 @@ export const getFieldDefaultPreviewValue = ({
|
||||
// Select field
|
||||
if (
|
||||
fieldMetadataItem.type === FieldMetadataType.Select &&
|
||||
isNonNullable(selectOptions)
|
||||
isDefined(selectOptions)
|
||||
) {
|
||||
return selectOptions.find(({ isDefault }) => isDefault) || selectOptions[0];
|
||||
}
|
||||
@ -32,7 +32,7 @@ export const getFieldDefaultPreviewValue = ({
|
||||
// Relation field
|
||||
if (
|
||||
fieldMetadataItem.type === FieldMetadataType.Relation &&
|
||||
isNonNullable(relationObjectMetadataItem)
|
||||
isDefined(relationObjectMetadataItem)
|
||||
) {
|
||||
const relationLabelIdentifierFieldMetadataItem =
|
||||
getLabelIdentifierFieldMetadataItem(relationObjectMetadataItem);
|
||||
|
||||
@ -7,8 +7,8 @@ import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||
import { ImageInput } from '@/ui/input/components/ImageInput';
|
||||
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
|
||||
import { useUploadProfilePictureMutation } from '~/generated/graphql';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isNullable } from '~/utils/isNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const ProfilePictureUploader = () => {
|
||||
const [uploadPicture, { loading: isUploading }] =
|
||||
@ -27,7 +27,7 @@ export const ProfilePictureUploader = () => {
|
||||
});
|
||||
|
||||
const handleUpload = async (file: File) => {
|
||||
if (isNullable(file)) {
|
||||
if (isUndefinedOrNull(file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ export const ProfilePictureUploader = () => {
|
||||
};
|
||||
|
||||
const handleAbort = async () => {
|
||||
if (isNonNullable(uploadController)) {
|
||||
if (isDefined(uploadController)) {
|
||||
uploadController.abort();
|
||||
setUploadController(null);
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@ import { useRecoilValue } from 'recoil';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isNullable } from '~/utils/isNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { logError } from '~/utils/logError';
|
||||
|
||||
const StyledComboInputContainer = styled.div`
|
||||
@ -39,7 +39,7 @@ export const NameField = ({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const debouncedUpdate = useCallback(
|
||||
debounce(async (name: string) => {
|
||||
if (isNonNullable(onNameUpdate)) {
|
||||
if (isDefined(onNameUpdate)) {
|
||||
onNameUpdate(displayName);
|
||||
}
|
||||
if (!autoSave || !name) {
|
||||
@ -54,7 +54,7 @@ export const NameField = ({
|
||||
},
|
||||
});
|
||||
|
||||
if (isNonNullable(errors) || isNullable(data?.updateWorkspace)) {
|
||||
if (isDefined(errors) || isUndefinedOrNull(data?.updateWorkspace)) {
|
||||
throw errors;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
useUpdateWorkspaceMutation,
|
||||
useUploadWorkspaceLogoMutation,
|
||||
} from '~/generated/graphql';
|
||||
import { isNullable } from '~/utils/isNullable';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const WorkspaceLogoUploader = () => {
|
||||
const [uploadLogo] = useUploadWorkspaceLogoMutation();
|
||||
@ -17,7 +17,7 @@ export const WorkspaceLogoUploader = () => {
|
||||
);
|
||||
|
||||
const onUpload = async (file: File) => {
|
||||
if (isNullable(file)) {
|
||||
if (isUndefinedOrNull(file)) {
|
||||
return;
|
||||
}
|
||||
if (!currentWorkspace?.id) {
|
||||
|
||||
Reference in New Issue
Block a user