Skip to content

Conversation

@sfc-gh-bnisco
Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Jan 6, 2026

Describe your changes

Allow CCv2 components with no HTML, CSS, or JavaScript content to render without errors. Previously, the system would raise a BidiComponentMissingContentError if 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

  • Unit Tests (Python): Added tests to verify that components with only CSS or no content at all can be mounted without raising exceptions
  • E2E Tests: Added a test case with an empty component to verify it renders correctly without crashing the app
  • Manual Testing: The empty component can be visually verified in the e2e test app

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

✅ PR preview is ready!

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

@sfc-gh-bnisco sfc-gh-bnisco added the change:feature PR contains new feature or enhancement implementation label Jan 6, 2026 — with Graphite App
Copy link
Collaborator Author

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

@sfc-gh-bnisco sfc-gh-bnisco added impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR labels Jan 6, 2026 — with Graphite App
@snyk-io
Copy link
Contributor

snyk-io bot commented Jan 6, 2026

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.

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 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 BidiComponentMissingContentError exception 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

📉 Frontend coverage change detected

The frontend unit test (vitest) coverage has decreased by 0.0500%

  • Current PR: 86.4600% (12761 lines, 1727 missed)
  • Latest develop: 86.5100% (12761 lines, 1721 missed)

💡 Consider adding more unit tests to maintain or improve coverage.

📊 View detailed coverage comparison

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review January 6, 2026 22:39
@lukasmasuch
Copy link
Collaborator

@cursor review

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link

@cursor cursor bot left a 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!

@sfc-gh-bnisco sfc-gh-bnisco merged commit 4b2d26a into develop Jan 7, 2026
74 of 76 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the 01-05-_feat_allow_for_optional_js_css_and_html_params_in_ccv2 branch January 7, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement 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