Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Jul 25, 2025

Describe your changes

Implements support for rerunning the app when the dialog gets dismissed by the user. This can be activated via on_dismiss="rerun" or callback.

GitHub Issue Link (if applicable)

Testing Plan

  • Added unit and e2e tests.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Jul 25, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12034/streamlit-1.47.1-py3-none-any.whl
🕹️ Preview app pr-12034.streamlit.app (☁️ Deploy here if not accessible)

@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Jul 25, 2025
@lukasmasuch lukasmasuch changed the title [WIP] Add on dismiss callback to dialog Add on dismiss callback to dialog Jul 25, 2025
@lukasmasuch lukasmasuch requested a review from Copilot July 25, 2025 10:36
@lukasmasuch lukasmasuch marked this pull request as ready for review July 25, 2025 10:36
@lukasmasuch lukasmasuch requested a review from a team as a code owner July 25, 2025 10:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for rerunning the app when a dialog gets dismissed by the user. It adds an on_dismiss parameter to the dialog decorator that can be set to "rerun" to trigger app reruns or to a callback function for custom dismissal handling.

  • Adds on_dismiss parameter to dialog decorator and internal dialog implementation
  • Integrates dialog dismissal with Streamlit's widget system for state management
  • Extends frontend dialog component to send widget events on dismissal

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
proto/streamlit/proto/Block.proto Adds id field to Dialog message for widget registration
lib/streamlit/elements/lib/dialog.py Implements on_dismiss functionality with widget registration
lib/streamlit/elements/layouts.py Passes on_dismiss parameter to dialog creation
lib/streamlit/elements/dialog_decorator.py Adds on_dismiss parameter to dialog decorator API
frontend/lib/src/components/elements/Dialog/Dialog.tsx Implements frontend dismissal handling with widget events
frontend/lib/src/components/core/Block/Block.tsx Passes widget manager and fragment ID to Dialog component
lib/tests/streamlit/elements/layouts_test.py Adds unit tests for on_dismiss functionality
frontend/lib/src/components/elements/Dialog/Dialog.test.tsx Adds frontend tests for dismissal behavior
e2e_playwright/st_dialog.py Adds test app for on_dismiss functionality
e2e_playwright/st_dialog_test.py Adds end-to-end tests for dialog dismissal

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot free trial expires on July 29, 2025
Learn more in the Cursor dashboard.

@lukasmasuch lukasmasuch changed the title Add on dismiss callback to dialog Add support for rerunning app when dialog gets dismissed Jul 25, 2025
@lukasmasuch lukasmasuch merged commit c845240 into develop Jul 25, 2025
39 checks passed
@lukasmasuch lukasmasuch deleted the add-on-dismiss-to-dialog branch July 25, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rerun when dismissing st.dialog by clicking on X or pressing Escape

3 participants