fix(oauth): use createElement for icon components to fix React hooks error#3064
fix(oauth): use createElement for icon components to fix React hooks error#3064waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR fixes React error #310 (invalid hook call) that occurred when opening the Integrations tab in settings. The issue was caused by icon components being called as functions ( Changes Made:
Root Cause: Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant IntegrationsTab
participant CredentialSelector
participant OAuthProviders
participant IconComponent
User->>IntegrationsTab: Opens Integrations tab
IntegrationsTab->>OAuthProviders: Fetch provider configs
OAuthProviders-->>IntegrationsTab: Return configs with icon components
alt Before Fix (Invalid Hook Call)
IntegrationsTab->>IconComponent: icon({ className })
Note over IntegrationsTab,IconComponent: Direct function call<br/>violates Rules of Hooks
IconComponent--xIntegrationsTab: Error #310: Invalid hook call
end
alt After Fix (Proper Rendering)
IntegrationsTab->>IconComponent: createElement(icon, { className })
Note over IntegrationsTab,IconComponent: Proper React element creation<br/>hooks work correctly
IconComponent-->>IntegrationsTab: Rendered icon element
end
IntegrationsTab-->>User: Display integrations with icons
User->>CredentialSelector: Select credential
CredentialSelector->>OAuthProviders: Get provider icon
CredentialSelector->>IconComponent: createElement(icon, { className })
IconComponent-->>CredentialSelector: Rendered icon element
CredentialSelector-->>User: Display credential with icon
|
Summary
icon({ className })tocreateElement(icon, { className })in 3 filesType of Change
Testing
Tested manually
Checklist