refactor: tighten types and reuse instrument UI
Frontend verify / commits (pull_request) Successful in 24s
Frontend verify / security (pull_request) Failing after 9s
Frontend verify / verify (pull_request) Skipped

This commit is contained in:
2026-09-29 06:15:31 +03:00
parent b404c1802a
commit 7c28a423dd
67 changed files with 380 additions and 347 deletions
+2 -2
View File
@@ -403,7 +403,7 @@ describe("banking API", () => {
);
await waitFor(() =>
expect(result.current.categories.data?.[0].name).toBe("Food"),
expect(result.current.categories.data?.[0]?.name).toBe("Food"),
);
await act(() =>
result.current.updateCategory.mutateAsync({
@@ -412,7 +412,7 @@ describe("banking API", () => {
}),
);
await waitFor(() =>
expect(result.current.categories.data?.[0].name).toBe("Groceries"),
expect(result.current.categories.data?.[0]?.name).toBe("Groceries"),
);
await act(() =>
result.current.updateOperation.mutateAsync({
+10 -10
View File
@@ -46,16 +46,16 @@ function useBankMutationOptions() {
return {
onError: (error: unknown) => {
const errorCode = apiErrorCode(error);
if (
[
ApiErrorCode.BankDependentRefunds,
ApiErrorCode.BankIntentConflict,
ApiErrorCode.BankRefundLimit,
ApiErrorCode.BankVersionConflict,
ApiErrorCode.BankWriteConflict,
].some(code => isApiErrorCode(errorCode, code))
)
return invalidate();
return [
ApiErrorCode.BankDependentRefunds,
ApiErrorCode.BankIntentConflict,
ApiErrorCode.BankRefundLimit,
ApiErrorCode.BankVersionConflict,
ApiErrorCode.BankWriteConflict,
].some(code => isApiErrorCode(errorCode, code))
? invalidate()
: undefined;
},
onSuccess: invalidate,
retry: false,
+2 -1
View File
@@ -143,7 +143,7 @@ function useBankOperations(
return !isAll
&& previousQuery?.queryKey.length === options.queryKey.length
&& previous?.path?.id === id
&& previous?.path.id === id
&& previous?.query?.month === query.month
&& previous?.query?.from === query.from
&& previous?.query?.to === query.to
@@ -165,6 +165,7 @@ function useBankOperations(
// eslint-disable-next-line @typescript-eslint/only-throw-error -- Preserve generated ProblemDetails for apiErrorCode and field-error consumers.
if (error) throw error;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- An empty HTTP body can violate the generated response contract.
if (!data) throw new Error("Missing bank operations response");
if (!isAll) return data;
items.push(...data.items);