Skip to content

Fix useCopilotAction handler re-render bug#1

Draft
ZebraRoy wants to merge 2 commits into
mainfrom
cursor/fix-usecopilotaction-handler-re-render-bug-ad75
Draft

Fix useCopilotAction handler re-render bug#1
ZebraRoy wants to merge 2 commits into
mainfrom
cursor/fix-usecopilotaction-handler-re-render-bug-ad75

Conversation

@ZebraRoy

@ZebraRoy ZebraRoy commented Oct 8, 2025

Copy link
Copy Markdown
Owner

What does this PR do?

This PR addresses a bug where useCopilotAction handlers could trigger multiple times during re-renders. To prevent this, an executionId is now passed to the action handler, allowing for deduplication of executions.

Changes include:

  • Updating FunctionCallHandlerArguments and Action.handler types to include an optional executionId in a meta object, maintaining backward compatibility.
  • Propagating the executionId from the action execution message through use-chat, CopilotKitInternal (provider), and the runtime service adapter to both frontend and backend action handlers.
  • Updating the useCopilotAction documentation to reflect the new handler(args, meta?) signature and the availability of meta.executionId.

Related PRs and Issues

N/A

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation

Open in Cursor Open in Web

Co-authored-by: elcngchunyik <elcngchunyik@gmail.com>
@cursor

cursor Bot commented Oct 8, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Co-authored-by: elcngchunyik <elcngchunyik@gmail.com>
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.

2 participants