Deleting a key from Session State WILL ~~not~~ revert the widget to a default value
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 64/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
ウィジェットの動作に関するドキュメントページから始め、提供されている Python スニペットを Streamlit で再現します。観測したリセットを、st.session_state からキーを削除することについての現在の記述と比較します。ページが動作を正確に説明し、その例がドキュメントに記載された結果と矛盾しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The following statement in the docs dont seem to be true to me. I cant replicate the behaviour stated.
Doc Page: https://docs.streamlit.io/develop/concepts/architecture/widget-behavior
"
Calling a widget command when the widget already exists
When rerunning a script without changing a widget's identity:
Streamlit will connect to the existing frontend and backend parts.
If the widget has a key that was deleted from st.session_state, then Streamlit will recreate the key using the current frontend value. This is because deleting a key from Session State will not revert the widget to a default value.
The widget command will return the current value of the widge
"
Here is the code I used to replicate the stated behaviour:
"
import streamlit as st
st.title("Streamlit Widget Behavior Demo")
if "my_slider" in st.session_state:
del st.session_state["my_slider"]Initialize a widget with a key.,
current_val = st.slider("Move this slider:", min_value=0, max_value=100, value=0, key="my_slider")
Display the current state
st.write(f"The widget command returned:
{current_val}")
st.write("Currentst.session_statecontents:", st.session_state.to_dict())
"
The widget command does return the default value if the related key is deleted beforehand.
Please explain to me why this is the case if I misunderstodd the docs.
- 主要言語
- JavaScript
- スター
- 178
- フォーク
- 711
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 19
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
streamlit/docs のほかの issue
-
Fix description of Azure SQL support対応中かも @Nikhil-jaiswal007 が 182 日前に担当しました。 オープンdocs needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
streamlit/docs#1260 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
streamlit/docs#719 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
App.run() does not serve a mounted ASGI app (routes=[Mount(...)]) that works with uvicorn.run(app)オープンbug needs triage
難易度 4/5 1〜2日 初心者へのやさしさ 22/100
メンテナーはふだん 2 日以内に返信
-
docs needs triage
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
bug needs triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
bug lsp sev-3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
Miaotofu01/Study-Mate#206 ·
メンテナーはふだん 1 日以内に返信
-
effort:low model:light plan planner:fable-5-1 test-quality tests
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
zhw2590582/ArtPlayer#1073 ·