Repository: streamlit/streamlit

Issue:
CachedStFunctionWarning with st.code
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

I am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. 

![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)

### Reproducible Code Example

[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)

```Python
@st.cache_data(experimental_allow_widgets=True, show_spinner=False)
def foo(i):
    options = ["foo", "bar", "baz", "qux"]
    st.code(options)
    r = st.radio("radio", options, index=i)
    return r

foo(1)
```


### Steps To Reproduce

1. Use code provided above
2. See warning message

### Expected Behavior

Warning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.

### Current Behavior

![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)


### Is this a regression?

- [X] Yes, this used to work in a previous version.

### Debug info

Streamlit version: 1.23.1
Python version: 3.11.1


### Additional Information

Further infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)
CachedStFunctionWarning with st.code
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

I am getting 'CachedStFunctionWarning' for st.code. Using `@st.cache_data(experimental_allow_widgets=True) ` as suggested in the warning does not help. 

![image](https://github.com/streamlit/streamlit/assets/122267325/ffe9ec4d-b07a-4310-8a21-6c51e751d757)

### Reproducible Code Example

[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055)

```Python
@st.cache_data(experimental_allow_widgets=True, show_spinner=False)
def foo(i):
    options = ["foo", "bar", "baz", "qux"]
    st.code(options)
    r = st.radio("radio", options, index=i)
    return r

foo(1)
```


### Steps To Reproduce

1. Use code provided above
2. See warning message

### Expected Behavior

Warning is not shown for st.code or using `@st.cache_data(experimental_allow_widgets=True) `  suppresses the warning.

### Current Behavior

![image](https://github.com/streamlit/streamlit/assets/122267325/de384f85-768b-49f2-ac4f-3a87a77de85c)


### Is this a regression?

- [X] Yes, this used to work in a previous version.

### Debug info

Streamlit version: 1.23.1
Python version: 3.11.1


### Additional Information

Further infos/community question [here](https://discuss.streamlit.io/t/st-cache-data-experimental-allow-widgets-true-is-not-working-with-st-code/47638)


Discussion:
That's indeed a bug that I was able to reproduce here [![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055), that should work without setting any paramters. FYI @AnOctopus
This is a regression. Used to work in 1.20.0
That's indeed a bug that I was able to reproduce here [![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlit.app/?issue=gh-7055), that should work without setting any paramters. FYI @AnOctopus
This is a regression. Used to work in 1.20.0

Resolving patch:
diff --git a/lib/streamlit/elements/__init__.py b/lib/streamlit/elements/__init__.py
--- a/lib/streamlit/elements/__init__.py
+++ b/lib/streamlit/elements/__init__.py
@@ -46,6 +46,7 @@
     "balloons",
     "bar_chart",
     "bokeh_chart",
+    "code",
     "data_frame",
     "dataframe_selector",
     "deck_gl_json_chart",
@@ -61,6 +62,9 @@
     "legacy_data_frame",
     "legacy_vega_lite",
     "line_chart",
+    # link_button unlike button and download_button is not a widget. It only sends a
+    # forward messages to the frontend, and not sends trigger value back.
+    "link_button",
     "markdown",
     "metric",
     "plotly_chart",


Test patch: