Appsilon / shiny.emptystate

Empty state components for Shiny
https://appsilon.github.io/shiny.emptystate/
27 stars 2 forks source link

[Feature]: support for javascript condition check #50

Open erikrenz88 opened 1 year ago

erikrenz88 commented 1 year ago

Guidelines

Description

Add a "condition" argument to empty_state_manager (potentially) to allow for adding a javascript condition that will show or hide the empty state.

Problem

There is not a standard way I've seen to currently have a spinner or loading screen connected to a loading screen unless a conditionalPanel is used with javascript in the condition. While other spinner packages exist, it is difficult to customize this without using a conditionalPanel or being forced to use limited spinner options. In particular, I'd like to use the shiny.fluent Spinner() while my dataset loads but I can't attach this to the "shiny-busy" class within the javascript.

Proposed Solution

Add a condition argument to allow for users to show/hide the empty state based on javascript elements (in particular, shiny-busy). Similar to "condition" of conditionalPanel.

Alternatives Considered

I've tried using a conditionalPanel in a fluidPage in a module and then add this to my main fluentPage similar to the dashboard tutorial on the shiny.fluent side, but there seems to be a disconnect when trying to mix these UI states. I also thought about using a counter value in a reactiveValues and watching for the counter to increase (change) which would occur once the dataset is pulled into the reactiveValues variable but it feels like this is a more crude work around to actually monitoring whether shiny is busy.