Skip to content

docs: Add modal_show/remove examples #1628

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

Merged
merged 5 commits into from
Aug 29, 2024
Merged

docs: Add modal_show/remove examples #1628

merged 5 commits into from
Aug 29, 2024

Conversation

gadenbuie
Copy link
Collaborator

Fixes posit-dev/py-shiny-site#201
Related: #1318

Adds an example using ui.modal_show() and ui.modal_remove() that is re-used in the documentation for both functions.

@gadenbuie gadenbuie requested a review from cpsievert August 22, 2024 13:45
# Now that we have model results, remove the modal
# and update the model result reactive value
ui.modal_remove()
model_result.set(result)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're going to set a reactive val here, let's display it somewhere? I'd also be fine getting rid of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we should get rid of it; it's a core part of the pattern. On the other hand I don't think it's worth showing the value; that ends up just being something to delete if you use this example as a template.

Copy link
Collaborator

@cpsievert cpsievert Aug 28, 2024

Choose a reason for hiding this comment

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

it's a core part of the pattern

It's a core part of a pattern, but not everyone coming to modal_remove() wants that pattern (e.g., maybe they just want to delay n seconds, or provide another UI control to close)? IMO introducing state that isn't actually used has potential to cause confusion. That said, I ultimately don't want to dwell on such a minor detail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a core part of a pattern, but not everyone coming to modal_remove() wants that pattern

lol very true. I meant "the pattern being demonstrated", not the only pattern.

IMO introducing state that isn't actually used has potential to cause confusion.

I probably wouldn't have included it either, but I've independently shown this pattern to 2-4 different people asking about how to remove the modal.

@gadenbuie gadenbuie merged commit 0f9ec9e into main Aug 29, 2024
48 checks passed
@gadenbuie gadenbuie deleted the docs/ui-remove-modal branch August 29, 2024 16:46
schloerke added a commit to machow/py-shiny that referenced this pull request Sep 5, 2024
* main:
  CI(deploy): Add more installation configs to surface failure cause (posit-dev#1658)
  `Chat.messages()` no longer trims messages by default (posit-dev#1657)
  tests(controllers): Split _controls.py into separate files (posit-dev#1652)
  Chat tweaks (posit-dev#1607)
  docs: Add modal_show/remove examples (posit-dev#1628)
  Delay sending of chat UI messages until reactive graph is flushed (posit-dev#1593)
  ci(remove future behavior warning): Set the `asyncio_default_fixture_loop_scope` to `fixture` (posit-dev#1655)
  bug: Verify mypy can run on CI (posit-dev#1650)
  Fix CI install failures on Windows (posit-dev#1651)
  Quartodoc 0.7.6 (posit-dev#1636)
  Allow `@chat.transform_assistant_response` function to return `None` (posit-dev#1641)
  feat: Support templates with `_template.json` metadata (posit-dev#1631)
  Fix KeyError when serving static files (posit-dev#1648)
  tests(navsets): Add navsets kitchensink tests (posit-dev#1602)
  Change default claude model to 3.5 sonnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

page for modal_remove does not actually show how to use the function
2 participants