Skip to content

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

Closed
@cpsievert

Description

@cpsievert

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions