-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] Include default in key for CCv2 instances #13266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] Include default in key for CCv2 instances #13266
Conversation
✅ 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. |
✅ PR preview is ready!
|
There was a problem hiding this 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
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 |
sfc-gh-nbellante
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍

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.