-
Notifications
You must be signed in to change notification settings - Fork 4k
[feat] Move the isolate_styles param in CCv2 #13518
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
[feat] Move the isolate_styles param in CCv2 #13518
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 refactors the isolate_styles parameter in the Custom Components v2 API, moving it from component mount-time to registration-time. This makes the API more intuitive by configuring style isolation once when defining the component, rather than repeatedly at each mount point.
Key changes:
- Added
isolate_stylesparameter to thecomponent()function for registration-time configuration - Implemented backward compatibility by silently ignoring
isolate_stylesif passed at mount time - Updated documentation examples in type definitions to reflect the new API usage
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/streamlit/components/v2/__init__.py |
Added isolate_styles parameter to component() and _create_component_callable() functions; removed it from _mount_component() signature; added backward compatibility logic to ignore legacy mount-time usage |
lib/streamlit/components/v2/types.py |
Removed isolate_styles documentation from BidiComponentCallable protocol; updated Example 2 to show isolate_styles usage at registration time instead of mount time |
lib/tests/streamlit/components/v2/test_component_registry.py |
Added test test_component_mount_ignores_isolate_styles_kwarg() to verify backward compatibility when isolate_styles is passed at mount time |
e2e_playwright/bidi_components/basics.py |
Removed isolate_styles=True from all component mount calls (4 occurrences) as it's now configured at registration time |
c52673d to
1d3b6da
Compare
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
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
1d3b6da to
399533d
Compare
|
@cursor review |
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.
✅ Bugbot reviewed your changes and found no bugs!
lukasmasuch
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 👍 but maybe it makes sense to show a deprecation warning via show_deprecation_warning
399533d to
d5cd315
Compare
d5cd315 to
b9e7980
Compare

Describe your changes
Move
isolate_stylesparameter from component mount-time to component registration time. This change makes the API more intuitive by setting style isolation when defining a component rather than when mounting it.Key changes:
isolate_stylesparameter tocomponent()functionisolate_stylesparameter from the component mount functionisolate_stylesif passed at mount timeisolate_styles=Truefrom component calls in e2e testsTesting Plan
test_component_mount_ignores_isolate_styles_kwarg()to verify that passingisolate_stylesat mount time is properly handled for backward compatibilityContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.