[feat] Allow for optional js, css, and html params in CCv2#13511
Conversation
✅ PR preview is ready!
|
✅ 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. |
There was a problem hiding this comment.
Pull request overview
This PR removes the requirement for CCv2 components to have HTML or JavaScript content, allowing components with any combination of HTML, CSS, and JavaScript (including none at all) to render without errors. Previously, the system would raise a BidiComponentMissingContentError if a component didn't have at least HTML or JavaScript content.
Key Changes
- Removed content validation that enforced the presence of HTML or JS
- Removed the
BidiComponentMissingContentErrorexception class - Updated documentation to reflect that all content parameters are optional
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/streamlit/errors.py |
Removed BidiComponentMissingContentError exception class |
lib/streamlit/components/v2/bidi_component/main.py |
Removed validation logic that checked for presence of JS or HTML content |
lib/streamlit/components/v2/__init__.py |
Updated docstring to reflect that all content parameters are optional |
lib/streamlit/components/v2/types.py |
Added module-level documentation about optional content parameters |
lib/tests/streamlit/components/v2/test_bidi_component.py |
Refactored tests to verify CSS-only and empty components work correctly |
e2e_playwright/bidi_components/basics.py |
Added empty component test case to the E2E app |
e2e_playwright/bidi_components/basics_test.py |
Added E2E test to verify empty components render without crashing |
The changes are well-implemented and consistent across the codebase. The removed validation logic is properly replaced with tests that verify the new behavior works correctly. No issues found during review.
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0500%
💡 Consider adding more unit tests to maintain or improve coverage. |
|
@cursor review |

Describe your changes
Allow CCv2 components with no HTML, CSS, or JavaScript content to render without errors. Previously, the system would raise a
BidiComponentMissingContentErrorif a component didn't have at least HTML or JavaScript content. This change removes that restriction, allowing empty components to render as empty placeholders.Updated the component documentation to reflect that components can have any combination of HTML, CSS, and JavaScript, including none at all.
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.