Skip to content

[feat] Add support for multiple callbacks on frontend#12747

Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack-22
Oct 24, 2025
Merged

[feat] Add support for multiple callbacks on frontend#12747
sfc-gh-bnisco merged 1 commit intodevelopfrom
bnisco/ccv2-stack-22

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Oct 10, 2025

Describe your changes

This PR adds the ability to send multiple callback updates in a single task from the frontend. This prevents race conditions where multiple trigger updates sent in the same macrotask could result in only the latest one being processed by the backend.

This is important for CCv2 because components can set multiple pieces of state in the same macrotask, such as:

setTriggerValue("foo", true);
setTriggerValue("bar", false);
setStateValue("baz", 123);

Key changes:

  • Added batching mechanism for widget updates
  • Implemented JSON payload aggregation for trigger widgets
  • Aligned ChatInput behavior with the same batching mechanism
  • Updated tests to use async/await with waitFor to properly test asynchronous widget updates

GitHub Issue Link (if applicable)

Testing Plan

  • Unit Tests: Added comprehensive test suite for the new batched trigger functionality, including tests for:
    • Single trigger payloads
    • Multiple aggregated payloads
    • Coalescing JSON values with trigger values
    • Edge cases like parse failures and fragment ID handling
  • A few existing tests were updated to use async/await pattern with waitFor to properly test the asynchronous widget update behavior

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Oct 10, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 10, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12747/streamlit-1.50.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12747.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Copy Markdown
Collaborator Author

sfc-gh-bnisco commented Oct 10, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-22 branch 2 times, most recently from e5ddf91 to f7de4e2 Compare October 24, 2025 16:22
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-21 branch 2 times, most recently from 4793b0d to 424affe Compare October 24, 2025 18:14
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-22 branch 2 times, most recently from 6c12a5c to fc3bd23 Compare October 24, 2025 18:14
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-21 branch 2 times, most recently from e6adf6d to ec51bc6 Compare October 24, 2025 19:06
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the bnisco/ccv2-stack-22 branch 2 times, most recently from 41e7b70 to cb88433 Compare October 24, 2025 19:07
@sfc-gh-bnisco sfc-gh-bnisco changed the base branch from bnisco/ccv2-stack-21 to graphite-base/12747 October 24, 2025 19:30
@graphite-app graphite-app bot changed the base branch from graphite-base/12747 to develop October 24, 2025 19:30
@sfc-gh-bnisco sfc-gh-bnisco merged commit f18e2f4 into develop Oct 24, 2025
37 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the bnisco/ccv2-stack-22 branch October 24, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:internal PR changes only affect internal code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants