Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/hooks/useNotifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe("useNotifications", () => {
expect(result.current.isLoading).toBe(false);
});

let prefs: Record<string, unknown> | null;
let prefs: Awaited<ReturnType<typeof result.current.getPreferences>>;
await act(async () => {
prefs = await result.current.getPreferences();
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/hooks/useWorkflowState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describe("useWorkflowState", () => {
expect(mockReject).toHaveBeenCalledWith({
object: "tasks",
recordId: "rec-1",
comment: "Needs changes",
reason: "Needs changes",
});
Comment on lines 172 to 176
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expectation will fail because the hook calls client.workflow.reject({ object, recordId, reason, comment }), so the argument object includes a comment key (as undefined when omitted). Update the assertion to either include comment: undefined or use a partial matcher (e.g., expect.objectContaining) so it matches the actual call shape.

Copilot uses AI. Check for mistakes.
});
});
4 changes: 3 additions & 1 deletion hooks/useNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Comment on lines 3 to +10
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@objectstack/spec/api is now a direct import. @objectstack/spec is not listed in package.json dependencies (only present via pnpm-lock as a transitive dep), so this can become brittle if the client package ever stops depending on it. Add @objectstack/spec as an explicit dependency (or switch to a type source that’s already a direct dependency) to keep installs/builds stable.

Copilot uses AI. Check for mistakes.

/* ------------------------------------------------------------------ */
/* Types */
Expand Down
5 changes: 3 additions & 2 deletions hooks/useWorkflowState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface UseWorkflowStateResult {
/** Approve a workflow step */
approve: (comment?: string) => Promise<WorkflowApproveResponse>;
/** Reject a workflow step */
reject: (comment?: string) => Promise<WorkflowRejectResponse>;
reject: (reason: string, comment?: string) => Promise<WorkflowRejectResponse>;
/** Refetch the workflow state */
refetch: () => Promise<void>;
}
Expand Down Expand Up @@ -121,10 +121,11 @@ export function useWorkflowState(
);

const doReject = useCallback(
async (comment?: string): Promise<WorkflowRejectResponse> => {
async (reason: string, comment?: string): Promise<WorkflowRejectResponse> => {
const result = await client.workflow.reject({
object: objectName,
recordId,
reason,
comment,
});
await fetchState();
Expand Down
Loading