Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component keeps refreshing when using dynamic custom values #2

Open
liorshk opened this issue Mar 15, 2021 · 4 comments
Open

Component keeps refreshing when using dynamic custom values #2

liorshk opened this issue Mar 15, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@liorshk
Copy link

liorshk commented Mar 15, 2021

Describe the bug
Component keeps refreshing when using dynamic custom values

To Reproduce

import random
randomlist = []
for i in range(0,5):
    n = random.randint(1,30)
    randomlist.append(n)
search_keywords = st_tags('Keywords:', 'Press enter to add more', randomlist)
@gagan3012
Copy link
Owner

gagan3012 commented Mar 15, 2021

Hello,
Currently, the component only accepts static lists
I am working on a fix to enable custom values. Please star the repo if you liked streamlit-tags

@gagan3012 gagan3012 added the bug Something isn't working label Apr 2, 2021
@babuus
Copy link

babuus commented Jun 27, 2023

is there any update on this?

@Jyothipyxis
Copy link

I am facing the same issue, is there any update on the fix ?

@CHerSun
Copy link

CHerSun commented Feb 26, 2024

I believe that's how Streamlit works. It hashes component based on all initial values - labels, starting values, options list, key, etc. If any of that changes - Streamlit treats the component as a new one, thus, refreshes it completely. Streamlit works like this for its core components, but I'm pretty sure 3rd party components are treated in the same way, judging from my experience.

That's one of the reasons, why selected value is stored in session_state, if component key is specified - to be able to programmatically change selected item / value (before component is rendered). Not all 3rd party components support that though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants