The Dropdown component makes the Markdown component visible, and it continues processing on the first page visit.
bug
### Describe the bug
Hi, I'm trying to use Dropdown to toggle the visibility property of a Markdown, but I've found that it keeps processing on the first toggle, and sometimes the browser freezes. There are no logs in the console, and I don't know how to fix it.
### Have you searched existing issues? 🔎
- [x] I have searched and found no existing issues
### Reproduction
gradio==6.14.0
MacOS: Sequoia 15.7.7
python version: 3.10
Browser: Chrome and Safari
```python
import gradio as gr
async def select_mode(chat_mode):
is_visible = True if chat_mode == "长期聊天" else False
return gr.update(visible=is_visible)
with gr.Blocks(fill_height=True) as demo:
with gr.Sidebar(open=False, position="left"):
gr.Markdown("# 🤖 聊天模式设置")
gr.Markdown("- 临时聊天:短期记忆\n\n- 长期聊天:短期记忆 + 长期记忆")
chat_mode = gr.Dropdown(
choices=["临时聊天", "长期聊天"],
label="聊天模式",
value="临时聊天"
)
remark = gr.Markdown(
value='⚠️ <span style="color: red;">离离原上草,一岁一枯荣;野火烧不尽,春风吹又生。</span>',
visible=False)
chat_mode.change(select_mode, chat_mode, remark, queue=False)
if __name__ == "__main__":
demo.queue().launch(server_name="0.0.0.0", theme=gr.themes.Ocean(), debug=True, show_error=True)
```
### Screenshot
<img width="1108" height="916" alt="Image" src="https://github.com/user-attachments/assets/9d7faa19-605e-4e71-8493-6b80ea11fa25" />
### Logs
```shell
```
### System Info
```shell
No message
```
### Severity
I can work around it
0 条评论