posit-dev / r-shinylive

https://posit-dev.github.io/r-shinylive/
Other
156 stars 16 forks source link

Reactive Validate Need Shiny vs. Shiny Live #61

Open quincountychsmn opened 7 months ago

quincountychsmn commented 7 months ago

The following code works correctly in a shiny application. However, when I run it in my shiny live application, it does not display the warning message. Is this a known issue or am I just doing something incorrectly?

Reactive Data

validatepar_01 <- reactive({
            validate(
                    need(
                        input$par_01 == df$field_01, paste("There is no data for ", input$par_01)
                        )
                    )
})

Edit* This is in R. I can move this to the R shinyLive issue page if you need me to. Sorry for putting it here.

Thank you

wch commented 7 months ago

Can you provide a minimal reproducible example? Even better if you also have a link to an app on shinylive.io, like this.

quincountychsmn commented 6 months ago

Thank you wch.

Below is a shinyLive app that has the same issue as my shinyLive application. If you click 5, it should display Plot is hidden for number 5. However, it does not. Is it more the code than the shinyLive environment?

https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKAZwAtaJWAlAB0IdJiw48+rAFadhEEQGIABABE4AMz5wVAVQCSIgK60VAHgC0KzdVMATAApQA5nHYiVK45zgBlXn45dgFcL1UDCAI7e10pIM5PFV9qOAJSSNRjUg9IYxh6OEYhPBUSvzhU9JUoFQh8wsZEErCCbiJaAjhOFQBeFQBGRAGABlCk1GoiUgB5bKyckphWRynSEoUFZXUtHWSigDcikV9GI8YLa01jKNJaEnY+BbCieeyBFRAk1SwKWIvSNxdJNpip6FBfPYVCQVIC4pU0uQofUCscIF5XqQFgASZarUFWFSMP5FfE5L7orwqA5QOj2KDkDyUql1OBweyPCA4lGNFQAQn6AFYwiUySpaD1ePZYujNEQLjyiipBRgNkkvAoWSCckMntlsYrGGEYFA+H0VKgIYzRWsbPKWuKufrDQJNSoAL4Kd0ibYAYWJDN0AWkNXQJ0CrAAguh2KZzaYwqdzuak0UthAlNHUCo3BAioGofRWCoALKdRhEThETSkFS+oioWhrDAqdgAJhGbYALAIW5HOJwJaQoFFgRWDrRYlD7MZGHwXDUVMQIOdOAz7ujgJGDEvuAz6NMALotgDitFIAAljPQ6w2m9NVRAwO7D0A

Thank you

gadenbuie commented 6 months ago

Thank you for the reproducible example @quinCHB! Here's another version that doesn't include shinyjs (not needed for the issue) and that sets shiny.trace = TRUE so that we can see the messages sent from the Shiny server: https://dub.sh/JA0UVp9

Locally when changing the input value to 5, I see the following messages logged in the console:

RECV {"method":"update","data":{"number":"5"}}
SEND {"progress":{"type":"binding","message":{"id":"myPlot","persistent":false}}}
SEND {"busy":"busy"}
SEND {"recalculating":{"name":"myPlot","status":"recalculating"}}
SEND {"recalculating":{"name":"myPlot","status":"recalculated"}}
SEND {"busy":"idle"}
SEND {"errors":{"myPlot":{"message":"Plot is hidden for number 5.","call":"NULL","type":["shiny.silent.error","validation"]}},"values":{},"inputMessages":[]}

But on shinylive, I only see the following:

RECV {"method":"update","data":{"number":"5"}}
SEND {"progress":{"type":"binding","message":{"id":"myPlot","persistent":false}}}
SEND {"busy":"busy"}
SEND {"recalculating":{"name":"myPlot","status":"recalculating"}}
SEND {"recalculating":{"name":"myPlot","status":"recalculated"}}
SEND {"busy":"idle"}
SEND {"errors":{},"values":{"myPlot":null},"inputMessages":[]}

shinylive reports using v1.8.0.9000, which is also what I'm using locally, although its unclear if I'm on the same commit locally as on shinylive.

quincountychsmn commented 6 months ago

This is great. So, it appears to be something in the shinyLive environment, correct? Would this be considered a bug or is it something we are doing? If it is a bug is there a workaround for it currently?

Also, could you share any information about the shiny.trace option you provided? I'm new to R shiny (self-taught) and I'm still working on learning how to improve performance.