Skip to content

UI element appearing unexpectedly since v1.55.0 #14249

@ghilesmeddour

Description

@ghilesmeddour

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

Hi,

Since upgrading to v1.55.0, I’ve noticed that some UI elements are appearing unexpectedly. This behavior seems to occur when a cached function is executed between the declaration of a tab and its content usage.

Here is a minimal reproducible example:

Reproducible Code Example

Open in Streamlit Cloud

import time

import streamlit as st


@st.cache_data
def foo():
    time.sleep(2)


section = st.segmented_control("Section", ["S1", "S2"])

if section == "S1":
    st.markdown("- S1.1")
    st.markdown("- S1.2")
elif section == "S2":
    (tab,) = st.tabs(["S2.Tab"])
    foo()
    tab.markdown("S2 Lorem")

Steps To Reproduce

  1. Click on the "S1" button
  2. Click on the "S2" button
Image Image

Expected Behavior

The element "- S1.2" should remain hidden.

Current Behavior

The element "- S1.2" is displayed, even though it should not be visible in this context.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.55.0
  • Python version: 3.14.3
  • Operating System: Windows 11
  • Browser: Chrome

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:frontendRelated to frontend aspectsfeature:cacheRelated to `st.cache_data` and `st.cache_resource`feature:st.tabsRelated to the `st.tabs` containerpriority:P2Medium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedtype:regressionThis bug is a regression from previous behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions