From 72a71818e74db253cdbea298b83b76b93ced8d27 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 5 Jun 2026 17:31:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20list-params=20?= =?UTF-8?q?=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=85=B3=E9=94=AE=E5=AD=97?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=92=8C=20useConfirmAction=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/helpers/list-params.ts | 3 ++- tests/web/use-confirm-action.test.ts | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/server/helpers/list-params.ts b/src/server/helpers/list-params.ts index 414466f..119f3a0 100644 --- a/src/server/helpers/list-params.ts +++ b/src/server/helpers/list-params.ts @@ -38,7 +38,8 @@ export function parseListParams( } } - const keyword = url.searchParams.get("keyword") ?? undefined; + const keywordRaw = url.searchParams.get("keyword"); + const keyword = keywordRaw === "" ? undefined : (keywordRaw ?? undefined); const sortBy = url.searchParams.get("sortBy") ?? undefined; const sortOrderParam = url.searchParams.get("sortOrder") ?? undefined; diff --git a/tests/web/use-confirm-action.test.ts b/tests/web/use-confirm-action.test.ts index 033c381..6fea189 100644 --- a/tests/web/use-confirm-action.test.ts +++ b/tests/web/use-confirm-action.test.ts @@ -16,6 +16,7 @@ describe("useConfirmAction", () => { let resolved = false; const action = () => { resolved = true; + return Promise.resolve(); }; const { result } = renderHook(() => useConfirmAction(), { wrapper: createWrapper() }); @@ -24,16 +25,6 @@ describe("useConfirmAction", () => { expect(resolved).toBe(true); }); - it("handles action error without throwing", async () => { - const action = () => { - throw new Error("失败"); - }; - const { result } = renderHook(() => useConfirmAction(), { wrapper: createWrapper() }); - - await act(() => result.current.confirmAction(action, "成功")); - expect(resolved).toBe(true); - }); - it("handles action error without throwing", async () => { const action = () => { throw new Error("失败");