Skip to content

Multiselect with format func getting cleared right after selecting an element since 1.53.0 #13646

@pkunze

Description

@pkunze

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

When updating to streamlit 1.53.0, a multiselect gets cleared immediately after selecting an item.
It works as expected when downgrading to 1.52.2 again.

Reproducible Code Example

Open in Streamlit Cloud

import streamlit as st

class test_class:
    def __init__(self, text, value):
        self.text = text
        self.valu = value

elements = [
    test_class("A", 1),
    test_class("B", 2)
]
st.multiselect("Test", elements, format_func=lambda x: x.text)

Steps To Reproduce

  1. select an item
  2. it appears for a short moment then the multiselect is cleared / the element is deselected

Expected Behavior

The element should remain selected

Current Behavior

No response

Is this a regression?

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

Debug info

  • Streamlit version: 1.53.0
  • Python version: Python 3.14.0
  • Operating System: Windows 11
  • Browser: Edge

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.multiselectRelated to the `st.multiselect` widgetpriority:P1High priority - fix within two weeksstatus: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