Skip to content

Widgets with identical "ids" should raise exception #40

@treuille

Description

@treuille

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):

image

and when you click the button, it fires twice:

image

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 

Metadata

Metadata

Assignees

Labels

type:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions