Skip to content

Conversation

@ddjain
Copy link
Contributor

@ddjain ddjain commented Nov 18, 2025

Problem

When clicking the edit (pencil) icon on a model in the Models page, the UI enters an infinite loop causing:
• Continuous page refreshing
• Infinite API calls to /models/new?edit=true&name=...
• Unusable interface

Root Cause

The useEffect hook in ui/src/app/models/new/page.tsx had isLoading in its dependency array. Since the effect calls setIsLoading(true), it triggers itself repeatedly.

Solution

• Removed isLoading from the useEffect dependency array
• Simplified loading state logic by removing conditional check

Changes

• Modified ui/src/app/models/new/page.tsx line 206
• Effect now only runs when actual dependencies change (edit mode, model name, providers, etc.)

Testing

• Edit model functionality now loads once and remains stable
• No more infinite API calls or page refreshing
• Model data loads correctly for editing

Fixes #1107 described in the bug report where editing models caused infinite loops.

Screenshot 2025-11-18 at 9 41 14 AM

@ddjain ddjain requested a review from peterj as a code owner November 18, 2025 04:17
@peterj
Copy link
Collaborator

peterj commented Nov 18, 2025

thanks! make sure you sign the DCO

Signed-off-by: ddjain <nnd.darshan@gmail.com>
@ddjain ddjain force-pushed the fix/model-edit-infinite-loop branch from c1b586b to 2615a17 Compare November 18, 2025 06:20
@peterj peterj merged commit 765917e into kagent-dev:main Nov 18, 2025
16 checks passed
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.

[BUG] Infinite API Calls When Clicking "Edit Model"

2 participants