From 00684556c0ed3f0f7470c63d4813863e4dd1a0c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:41:20 +0000 Subject: [PATCH 1/2] Initial plan From 4b295f16f59eca1019ad84a008ce797fb70a4d01 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:45:43 +0000 Subject: [PATCH 2/2] Fix TypeScript compilation errors in hooks and tests - Import GetNotificationPreferencesResponse and UpdateNotificationPreferencesResponse from @objectstack/spec/api instead of @objectstack/client - Fix test type assertion for NotificationPreferences - Add missing 'reason' parameter to workflow reject() method signature and implementation - Update test expectations to match new reject() signature Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- __tests__/hooks/useNotifications.test.ts | 2 +- __tests__/hooks/useWorkflowState.test.ts | 2 +- hooks/useNotifications.ts | 4 +++- hooks/useWorkflowState.ts | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/__tests__/hooks/useNotifications.test.ts b/__tests__/hooks/useNotifications.test.ts index 1c4d217..1d31da7 100644 --- a/__tests__/hooks/useNotifications.test.ts +++ b/__tests__/hooks/useNotifications.test.ts @@ -178,7 +178,7 @@ describe("useNotifications", () => { expect(result.current.isLoading).toBe(false); }); - let prefs: Record | null; + let prefs: Awaited>; await act(async () => { prefs = await result.current.getPreferences(); }); diff --git a/__tests__/hooks/useWorkflowState.test.ts b/__tests__/hooks/useWorkflowState.test.ts index ea9e2cf..33dbbe1 100644 --- a/__tests__/hooks/useWorkflowState.test.ts +++ b/__tests__/hooks/useWorkflowState.test.ts @@ -172,7 +172,7 @@ describe("useWorkflowState", () => { expect(mockReject).toHaveBeenCalledWith({ object: "tasks", recordId: "rec-1", - comment: "Needs changes", + reason: "Needs changes", }); }); }); diff --git a/hooks/useNotifications.ts b/hooks/useNotifications.ts index bfcddae..692fbbd 100644 --- a/hooks/useNotifications.ts +++ b/hooks/useNotifications.ts @@ -3,9 +3,11 @@ import { useClient } from "@objectstack/client-react"; import type { ListNotificationsResponse, RegisterDeviceResponse, +} from "@objectstack/client"; +import type { GetNotificationPreferencesResponse, UpdateNotificationPreferencesResponse, -} from "@objectstack/client"; +} from "@objectstack/spec/api"; /* ------------------------------------------------------------------ */ /* Types */ diff --git a/hooks/useWorkflowState.ts b/hooks/useWorkflowState.ts index a722199..d332005 100644 --- a/hooks/useWorkflowState.ts +++ b/hooks/useWorkflowState.ts @@ -48,7 +48,7 @@ export interface UseWorkflowStateResult { /** Approve a workflow step */ approve: (comment?: string) => Promise; /** Reject a workflow step */ - reject: (comment?: string) => Promise; + reject: (reason: string, comment?: string) => Promise; /** Refetch the workflow state */ refetch: () => Promise; } @@ -121,10 +121,11 @@ export function useWorkflowState( ); const doReject = useCallback( - async (comment?: string): Promise => { + async (reason: string, comment?: string): Promise => { const result = await client.workflow.reject({ object: objectName, recordId, + reason, comment, }); await fetchState();