Skip to content

Conversation

@sfc-gh-bnisco
Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Dec 8, 2025

Describe your changes

Include default state values in the identity calculation for unkeyed CCv2s. This ensures that when default values change for unkeyed components, they receive a new backend identity. For keyed components, the defaults are ignored in the identity calculation, maintaining stable identity across default value changes.

Testing Plan

  • Adds Python unit tests

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
Contributor

snyk-io bot commented Dec 8, 2025

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

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 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
Contributor

github-actions bot commented Dec 8, 2025

✅ PR preview is ready!

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

Copy link
Collaborator Author

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

@sfc-gh-bnisco sfc-gh-bnisco added change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR labels Dec 8, 2025 — with Graphite App
@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot December 9, 2025 17:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where unkeyed bidirectional component v2 (CCv2) instances would incorrectly maintain the same backend identity when their default values changed. The fix includes default state values in the identity calculation for unkeyed components while explicitly excluding them for keyed components to maintain stable identity.

  • Adds default parameter to identity calculation for CCv2 components
  • Ensures unkeyed components receive new backend IDs when defaults change
  • Preserves stable IDs for keyed components regardless of default changes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/streamlit/components/v2/bidi_component/main.py Adds default parameter to _build_bidi_identity_kwargs and includes it in the identity kwargs dictionary; updates docstrings to document the new behavior
lib/tests/streamlit/components/v2/test_bidi_component.py Adds three comprehensive unit tests covering stability and change scenarios for both keyed and unkeyed components with varying default values

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review December 9, 2025 18:35
Copy link
Contributor

@sfc-gh-nbellante sfc-gh-nbellante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@sfc-gh-bnisco sfc-gh-bnisco merged commit 1656d42 into develop Dec 10, 2025
60 of 61 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the 12-08-_fix_include_default_in_key_for_ccv2_instances branch December 10, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants