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

@ -15,8 +15,8 @@ import { useGenerateFindManyRecordsQuery } from '@/object-record/hooks/useGenera
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { ViewFilter } from '@/views/types/ViewFilter';
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
import { isNonNullable } from '~/utils/isNonNullable';
import { isNullable } from '~/utils/isNullable';
import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
const filterQueryParamsSchema = z.object({
filter: z.record(
@ -71,7 +71,7 @@ export const useFiltersFromQueryParams = () => {
field: fieldMetadataItem,
});
if (isNullable(filterDefinition)) return null;
if (isUndefinedOrNull(filterDefinition)) return null;
const relationObjectMetadataNameSingular =
fieldMetadataItem.toRelationMetadata?.fromObjectMetadata
@ -97,7 +97,7 @@ export const useFiltersFromQueryParams = () => {
if (
isNonEmptyString(relationObjectMetadataNamePlural) &&
isNonNullable(relationObjectMetadataItem) &&
isDefined(relationObjectMetadataItem) &&
Array.isArray(filterValueFromURL)
) {
const queryResult = await apolloClient.query<
@ -144,7 +144,7 @@ export const useFiltersFromQueryParams = () => {
},
),
)
).filter(isNonNullable);
).filter(isDefined);
},
[
apolloClient,

View File

@ -8,7 +8,7 @@ import { Sort } from '@/object-record/object-sort-dropdown/types/Sort';
import { savedViewSortsScopedFamilyState } from '@/views/states/savedViewSortsScopedFamilyState';
import { ViewSort } from '@/views/types/ViewSort';
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
import { isNullable } from '~/utils/isNullable';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
import { useViewScopedStates } from './useViewScopedStates';
@ -43,7 +43,7 @@ export const useViewSorts = (viewScopeId: string) => {
return;
}
if (isNullable(currentViewSorts)) {
if (isUndefinedOrNull(currentViewSorts)) {
return;
}
if (!savedViewSortsByKey) {