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

Allow outputs to stay in progress mode after flush #3954

Merged
merged 3 commits into from
Dec 12, 2023
Merged

Conversation

jcheng5
Copy link
Member

@jcheng5 jcheng5 commented Dec 6, 2023

Up until now, Shiny bound output enter progress mode (the .recalculating class is added) when their respective observer invalidates (source), and exit progress mode when that reactive flush cycle completes (source).

This PR adds a req(FALSE, cancelOutput="progress") which behaves similarly to cancelOutput=TRUE, but also keeps the output in .recalculating state even across flush cycles. This is called "persistent progress" and an output can leave this state when it is invalidated again and doesn't call req(FALSE, cancelOutput="progress") during that flush cycle.

This will be useful for implementing long-running tasks that don't hold up the flush cycle, leaving sessions responsive to do other tasks.

This feature is borderline internal (not that we can't commit to it, but because it's so low-level) so I'm not sure it needs a NEWS.md update--that can wait for the high-level feature we build on top of this, I think.

Adds a req(FALSE, cancelOutput="progress") which behaves similarly to
cancelOutput=TRUE, but also keeps the output in .recalculating state
even across flush cycles. This is called "persistent progress" and an
output can leave this state when it is invalidated again and doesn't
call req(FALSE, cancelOutput="progress") during that flush cycle.

This will be useful for implementing long-running tasks that don't
hold up the flush cycle, leaving sessions responsive to do other
tasks.
Doesn't matter much but this is closer to the old behavior
@jcheng5 jcheng5 requested review from schloerke and wch December 11, 2023 18:54
@jcheng5
Copy link
Member Author

jcheng5 commented Dec 11, 2023

The binding state management code is getting pretty creaky, but I don't think this is the straw that breaks the camel's back.

@jcheng5 jcheng5 merged commit 300fb21 into main Dec 12, 2023
11 checks passed
@jcheng5 jcheng5 deleted the persistent-progress branch December 12, 2023 20:23
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Dec 13, 2023
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Dec 13, 2023
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Jan 12, 2024
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Jan 16, 2024
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Jan 17, 2024
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Jan 19, 2024
jcheng5 added a commit to posit-dev/py-shiny that referenced this pull request Jan 19, 2024
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.

2 participants