-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Widgets with identical "ids" should raise exception #40
Copy link
Copy link
Closed
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected
Description
Summary
If you name, for example, two buttons 'abc', you will get some weird behavior (see below).
To avoid this, we should ensure that no two widgets have the same name by raising an exception should the user violate this rule.
Steps to reproduce
Run the following code:
import streamlit as st
if st.button('abc'):
st.success('First button fired.')
if st.button('abc'):
st.success('Second button fired.')Behavior
Actual behavior
The button appears twice (no exceptions thrown):
and when you click the button, it fires twice:
Expected behavior
The second button named 'abc' should raise an exception.
Is this a regression?
Not sure.
Debug info
$ streamlit version && python --version && pyenv --version && sw_vers && "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version
Streamlit, version 0.45.0
Python 3.6.5
pyenv 1.2.3
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G84
Google Chrome 76.0.3809.132
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected

