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

widget.empty() clears the widget only at the end of the script #2395

Closed
Wirg opened this issue Nov 30, 2020 · 5 comments · Fixed by #2617
Closed

widget.empty() clears the widget only at the end of the script #2395

Wirg opened this issue Nov 30, 2020 · 5 comments · Fixed by #2617
Assignees
Labels
area:widgets type:bug Something isn't working

Comments

@Wirg
Copy link

Wirg commented Nov 30, 2020

Hi and thank you for streamlit :)

Summary

Using widget.empty() on a widget, empty the widget but only when streamlit reach the end of the script.

Steps to reproduce

from time import sleep

import streamlit as st

widget = st.empty()
widget.write("original text")

sleep(2)

widget.empty()
st.write("cleared original text")

sleep(2)

st.text("end")

Expected behavior:

I expect widget.empty() to empty the widget "instantly" when I call the function. write, progress and other widgets already work this way (here before st.write("cleared original text")).

Actual behavior:

The widget is emptied when streamlit reaches the end of the script (here, after st.text("end")).

Is this a regression?

I don't know.

Debug info

  • Streamlit version: Streamlit, version 0.71.0
  • Python version: Python 3.6.9
  • Using Conda? PipEnv? PyEnv? Pex? : virtualenv
  • OS version:
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
  • Browser version: Version 86.0.4240.198 (Official Build) (64-bit
@Wirg Wirg added type:bug Something isn't working status:needs-triage Has not been triaged by the Streamlit team labels Nov 30, 2020
@nthmost nthmost self-assigned this Nov 30, 2020
@akrolsmir
Copy link
Contributor

Streamlit snippets of the code example: https://share.streamlit.io/akrolsmir/streamlit-snippet/main?snippet_id=FcAXRYMC

@nthmost nthmost added area:widgets and removed status:needs-triage Has not been triaged by the Streamlit team labels Dec 9, 2020
@Wirg
Copy link
Author

Wirg commented Dec 10, 2020

Hi !

Sorry for the bump. Could you tell me if it's considered as a bug and worth fixing ?
Or is it the normal behavior and I should consider a workaround ?

Thanks

@Wirg
Copy link
Author

Wirg commented Jan 4, 2021

Hi & Happy new year ! :)

Another bump to understand if it's considered as a bug and worth fixing ?
Or is it the normal behavior and I should consider a workaround ?

Thanks

@vdonato
Copy link
Collaborator

vdonato commented Jan 15, 2021

Hi! Sorry for the delay in getting back to you @Wirg, but yes this is certainly something that we're looking into fixing.

I'm actually just starting to see if I can polish the behavior of st.empty() so it works as expected.

@vdonato vdonato self-assigned this Jan 15, 2021
vdonato added a commit to vdonato/streamlit that referenced this issue Jan 20, 2021
\streamlit#2395 ended up being caused by this since we don't rerender placeholder
components created by `st.empty()` when react props/state change as a
performance optimization, but we need to do so when replacing an
existing component with an empty one to get rid of what's currently
drawn on screen.

Closes streamlit#2395
vdonato added a commit that referenced this issue Jan 21, 2021
\#2395 ended up being caused by this since we don't rerender placeholder
components created by `st.empty()` when react props/state change as a
performance optimization, but we need to do so when replacing an
existing component with an empty one to get rid of what's currently
drawn on screen.

Closes #2395
CFrez pushed a commit to CFrez/streamlit that referenced this issue Jan 21, 2021
\streamlit#2395 ended up being caused by this since we don't rerender placeholder
components created by `st.empty()` when react props/state change as a
performance optimization, but we need to do so when replacing an
existing component with an empty one to get rid of what's currently
drawn on screen.

Closes streamlit#2395
kmcgrady pushed a commit that referenced this issue Jan 25, 2021
* switched react-katex package

* lockfile updated

* update test to corrected spelling

* decapitalize KaTex

* Fix slider UX (#2596)

* Fix slider UX

* Add snapshot

* Revert "Deploy button front (#2552)" (#2599)

* Revert "Deploy button front (#2552)"

This reverts commit 0f66b6e.

* Fix merge (erm... revert) conflict.

* Revert "Deploy button py (#2535)"

This reverts commit 0bbc7aa.

Co-authored-by: karrie <karrie@streamlit.io>

* Remove extra period from sentence (#2601)

* Have st.number_input warn user of mismatched type and format string (#2604)

* Add %u to list of valid number_input formatters

* Have number_input warn user of mismatched type and format string

* Use more modern f-string syntax instead of .format()

* Feature/sudoless metrics (#2605)

* Add and use sudoless machine id getter for metrics

Step 2 of the metrics user ID improvement plan.

* Add machine-id v3 tests

Duplicates of the v1 tests, since those covered the cases that remain in v3,
and we will remove v1 and its tests later.

Also fix formatting of some python files.

* DRY out machine ID paths into global constants

* Increase side padding to 5rem when app is in wide mode (#2613)

* Increase side padding to 5rem when app is in wide mode

* Upload Cypress snapshot

* Rerender Maybe components when they're first disabled (#2617)

\#2395 ended up being caused by this since we don't rerender placeholder
components created by `st.empty()` when react props/state change as a
performance optimization, but we need to do so when replacing an
existing component with an empty one to get rid of what's currently
drawn on screen.

Closes #2395

Co-authored-by: karrie <karrie@streamlit.io>
Co-authored-by: Thiago Teixeira <thiago@streamlit.io>
Co-authored-by: Randy Zwitch <randy@streamlit.io>
Co-authored-by: Vincent Donato <vincent.rdonato@gmail.com>
Co-authored-by: Amanda Walker <amanda@amandawalker.io>
Co-authored-by: Austin Chen <akrolsmir@gmail.com>
Co-authored-by: Vincent Donato <vincent@streamlit.io>
@svats2k
Copy link

svats2k commented Aug 28, 2023

Any update on this thread?

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

Successfully merging a pull request may close this issue.

5 participants