Skip to content

fix(providers): read event.currentTarget before deferred setState in model editor#187

Merged
su-fen merged 1 commit into
mainfrom
fix/provider-model-edit-currenttarget-crash
Jul 21, 2026
Merged

fix(providers): read event.currentTarget before deferred setState in model editor#187
su-fen merged 1 commit into
mainfrom
fix/provider-model-edit-currenttarget-crash

Conversation

@su-fen

@su-fen su-fen commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Editing a model's contextWindow/maxOutputToken/other fields in the provider modal could crash: React nulls event.currentTarget before an async setState updater callback runs, so reading it inside setEditingModel((prev) => ...) was unsafe.
  • Capture the field value synchronously into a local variable before the deferred updater, in both agent-gateway/web and agent-gui (mirrored files).

Test plan

  • Open provider settings, edit a custom model, and update contextWindow/maxOutputToken/other fields without a crash (both WebUI and GUI)

…model editor

React nulls out event.currentTarget by the time an async setState updater
callback runs, so editing contextWindow/maxOutputToken/other model fields
in the provider modal could crash. Capture the value synchronously first.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@su-fen
su-fen merged commit 5aa4611 into main Jul 21, 2026
7 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.

1 participant