Skip to content

req(False, cancel_output="progress") sends an unexpected recalculated message immediately after progress #1355

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

Closed
cpsievert opened this issue May 6, 2024 · 0 comments · Fixed by #1356

Comments

@cpsievert
Copy link
Collaborator

Here's a fairly minimal example with extended_task, which uses (req(False, cancel_output="progress") under-the-hood).

import asyncio

from shiny import reactive
from shiny.express import app_opts, render

app_opts(debug=True)

@reactive.extended_task
async def slow_compute(a: int, b: int) -> int:
    await asyncio.sleep(3)
    return a + b


@reactive.effect
def handle_click():
    slow_compute(1, 2)


@render.text
def show_result():
    return str(slow_compute.result())
RECV: {"method":"init","data":{".clientdata_output_show_result_hidden":false,".clientdata_pixelratio":2.4,".clientdata_url_protocol":"http:",".clientdata_url_hostname":"localhost",".clientdata_url_port":"51621",".clientdata_url_pathname":"/",".clientdata_url_search":"?vscodeBrowserReqId=1715015365464",".clientdata_url_hash_initial":"",".clientdata_url_hash":"",".clientdata_singletons":""}}
SEND: {"busy": "busy"}
SEND: {"busy": "busy"}
SEND: {"busy": "idle"}
SEND: {"recalculating": {"name": "show_result", "status": "recalculating"}}
SEND: {"progress": {"type": "binding", "message": {"id": "show_result", "persistent": true}}}
SEND: {"recalculating": {"name": "show_result", "status": "recalculated"}}  <--- WRONG!
SEND: {"busy": "idle"}
SEND: {"values": {}, "inputMessages": [], "errors": {}}
SEND: {"progress": {"type": "binding", "message": {"id": "show_result"}}}
SEND: {"busy": "busy"}
SEND: {"recalculating": {"name": "show_result", "status": "recalculating"}}
SEND: {"recalculating": {"name": "show_result", "status": "recalculated"}}
SEND: {"busy": "idle"}
SEND: {"values": {"show_result": "3"}, "inputMessages": [], "errors": {}}

Note that this violates the output progress state machine that we added to shiny.js in rstudio/shiny#4039, which is why the playwright tests are now failing in #1353.

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 a pull request may close this issue.

1 participant