From a3fb9b656b7e9abe5741822cfd9e74b1dbd79702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 7 Feb 2025 16:11:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=87=E6=BB=A4=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E4=B8=AD=E7=9A=84=E7=A9=BA=E7=99=BD=E5=80=BC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/schemes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stores/schemes.ts b/src/stores/schemes.ts index f052eac..bea79d8 100644 --- a/src/stores/schemes.ts +++ b/src/stores/schemes.ts @@ -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, '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],