增加过滤记录中的空白值。

This commit is contained in:
徐涛 2025-02-07 16:11:15 +08:00
parent d817024bf3
commit a3fb9b656b

View File

@ -1,7 +1,7 @@
import dayjs from 'dayjs';
import { useAtomValue, useSetAtom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
import { isEqual, reduce } from 'lodash-es';
import { isEqual, isNil, reduce } from 'lodash-es';
import { useCallback, useMemo } from 'react';
import { v4 } from 'uuid';
import { SchemeContent, SchemeStorage, SchemeType } from '../models';
@ -47,6 +47,7 @@ export function useSchemeList(): Pick<SchemeContent<SchemeStorage>, 'id' | 'name
const sortedSchemes = useMemo(
() =>
schemes
.filter((item) => !isNil(item))
.sort((a, b) => dayjs(b.createdAt).diff(dayjs(a.createdAt)))
.map(({ id, name, createdAt, type }) => ({ id, name, createdAt, type })),
[schemes],