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

Recalculating outputs don't fade #185

Closed
jcheng5 opened this issue May 31, 2022 · 1 comment · Fixed by #193
Closed

Recalculating outputs don't fade #185

jcheng5 opened this issue May 31, 2022 · 1 comment · Fixed by #193
Assignees
Milestone

Comments

@jcheng5
Copy link
Collaborator

jcheng5 commented May 31, 2022

After the initial load of the output, move the slider.

Expected: The output should be semitransparent as we recalculate
Actual: The output stays opaque

from shiny import *
import asyncio

app_ui = ui.page_fluid(
    ui.input_slider("n", "N", 0, 100, 40),
    ui.output_text_verbatim("txt"),
)

def server(input, output, session):
    @output()
    @render_text()
    async def txt():
        await asyncio.sleep(5)
        return f"The value of n*2 is {input.n() * 2}"

app = App(app_ui, server)
@wch
Copy link
Collaborator

wch commented May 31, 2022

I think this is because we're not sending busy messages.

Here's the log from an R Shiny app:

SEND {"config":{"workerId":"","sessionId":"ea92ac937318c12ce640fcd4834af408","user":null}}
RECV {"method":"init","data":{"bins":30,".clientdata_output_distPlot_width":857,".clientdata_output_distPlot_height":400,".clientdata_output_distPlot_bg":"rgb(255, 255, 255)",".clientdata_output_distPlot_fg":"rgb(51, 51, 51)",".clientdata_output_distPlot_accent":"rgb(51, 122, 183)",".clientdata_output_distPlot_font":{"families":["Helvetica Neue","Helvetica","Arial","sans-serif"],"size":"14px"},".clientdata_output_distPlot_hidden":false,".clientdata_pixelratio":2,".clientdata_url_protocol":"http:",".clientdata_url_hostname":"127.0.0.1",".clientdata_url_port":"3781",".clientdata_url_pathname":"/",".clientdata_url_search":"",".clientdata_url_hash_initial":"",".clientdata_url_hash":"",".clientdata_singletons":""}}
SEND {"busy":"busy"}
SEND {"recalculating":{"name":"distPlot","status":"recalculating"}}
SEND {"recalculating":{"name":"distPlot","status":"recalculated"}}
SEND {"busy":"idle"}
SEND {"errors":{},"values":{"distPlot":{"src":"data:image/png;[base64 data]","width":857,"height":400,"alt":"Plot object","coordmap":{"panels":[{"domain":{"left":40.88,"right":98.12,"bottom":-1.08,"top":28.08},"range":{"left":118.08,"right":1653.52,"bottom":652.12,"top":117.08},"log":{"x":null,"y":null},"mapping":{}}],"dims":{"width":1714,"height":800}}}},"inputMessages":[]}

And one from a PyShiny app:

SEND: {"config": {"workerId": "", "sessionId": "1", "user": null}}
RECV: {"method":"init","data":{"n":40,".clientdata_output_txt_hidden":false,".clientdata_pixelratio":2
,".clientdata_url_protocol":"https:",".clientdata_url_hostname":"connect.rstudioservices.com",".client
data_url_port":"",".clientdata_url_pathname":"/content/5eb87cc3-f23d-4656-96ce-5b0a9359a50c/edit/app_2
fn637hff0gmee183egq/",".clientdata_url_search":"",".clientdata_url_hash_initial":"",".clientdata_url_h
ash":"",".clientdata_singletons":""}}
SEND: {"recalculating": {"name": "txt", "status": "recalculating"}}
SEND: {"recalculating": {"name": "txt", "status": "recalculated"}}
SEND: {"values": {"txt": "The value of n*2 is 80"}, "inputMessages": [], "errors": {}}

Also see #16.

@cpsievert cpsievert added this to the Alpha release milestone Jun 8, 2022
@cpsievert cpsievert self-assigned this Jun 8, 2022
cpsievert added a commit that referenced this issue Jun 8, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 8, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 8, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 8, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 13, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 15, 2022
…and output binding progress when an Output is recalculating
cpsievert added a commit that referenced this issue Jun 15, 2022
…s when an Output is recalculating (#193)

* Close #185 and close #16: send busy/idle when an Effect is executing and output binding progress when an Output is recalculating

* Add mock _send_message method instead of checking for its existence

* Use the new _send_message_sync() method

* Show progress right as soon as output is invalidated

* Update tests/test_poll.py

Co-authored-by: Winston Chang <winston@stdout.org>

Co-authored-by: Winston Chang <winston@stdout.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants