chore(streamlit): migrate components.v1.html → st.iframe (deprecation)
Streamlit logs a deprecation notice on every render: Please replace ``st.components.v1.html`` with ``st.iframe``. ``st.components.v1.html`` will be removed after 2026-06-01. Replace all 9 call sites (6 tool pages + 3 in ``_legacy.py``). Both APIs feed ``srcdoc`` to the underlying iframe so the HTML/JS payload and the cross-frame DOM access pattern (``window.parent.document``) are unchanged. ``st.iframe`` rejects ``height=0`` (raises ``StreamlitInvalid HeightError``), so bump every zero-height call to ``height=1``. 1px is effectively invisible — these are script-only iframes, no visible payload — and avoids the validator. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -400,8 +400,7 @@ with dl_c:
|
||||
# unrelated widgets in the Results section (e.g., the Show-hidden
|
||||
# toggle) don't yank the viewport back to the top of Results.
|
||||
if st.session_state.pop("_textclean_scroll_to_results", False):
|
||||
from streamlit.components.v1 import html as _components_html
|
||||
_components_html(
|
||||
st.iframe(
|
||||
"""
|
||||
<script>
|
||||
const doc = window.parent.document;
|
||||
@@ -409,5 +408,5 @@ if st.session_state.pop("_textclean_scroll_to_results", False):
|
||||
if (target) target.scrollIntoView({behavior: 'smooth', block: 'start'});
|
||||
</script>
|
||||
""",
|
||||
height=0,
|
||||
height=1,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user