[fix] Include default in key for CCv2 instances#13266
Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom Dec 10, 2025
Merged
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
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
defaultparameter 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.