Skip to content

🔧 Fix Code Quality: React Hook Called in Utility Function#1

Open
manos-saratsis wants to merge 1 commit into
masterfrom
orchestrai/fix-code_quality-1771148851753
Open

🔧 Fix Code Quality: React Hook Called in Utility Function#1
manos-saratsis wants to merge 1 commit into
masterfrom
orchestrai/fix-code_quality-1771148851753

Conversation

@manos-saratsis

Copy link
Copy Markdown
Owner

Issue Fixed

Type: Code Quality
File: frontend/src/utils.ts
Line: 39

Description

The handleError function calls useCustomToast() hook directly inside a utility function. React hooks must only be called from within React components or other custom hooks. This violates the rules of hooks and will cause runtime errors.

Suggested Fix

Refactor to accept the toast function as a parameter: export const handleError = (err: ApiError, showErrorToast: (message: string) => void) => { ... }

Changes Made

  • Applied AI-generated fix to resolve the issue
  • Preserved existing code structure and style

Generated by OrchestrAI Software Engineer

File: frontend/src/utils.ts
The handleError function calls useCustomToast() hook directly inside a utility function. React hooks must only be called from within React components or other custom hooks. This violates the rules of hooks and will cause runtime errors.

Generated by OrchestrAI Code Fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant