evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.18k stars 198 forks source link

Unset input values are always in a loading state #1479

Open ItsMeBrianD opened 8 months ago

ItsMeBrianD commented 8 months ago

Current behavior is an input value that is unset freezes the QueryStore to prevent errors; this is an intentional behavior.

The problem comes from inputs like ButtonGroup that may not have a default value, or where no selection (and no value) is a valid choice.

We should adjust the behavior to enter the "forever loading" state when the input value is undefined, and we should pass along null. null is an intentional empty where undefined is unintentional.

Components that do not need a default or initial value are responsible for setting their input key to null, Evidence should not handle this.

ItsMeBrianD commented 8 months ago

From @archiewood in #1480

Steps To Reproduce

Navigate to https://mdsinabox.com/nba/teams/

view the query filtered_summary_by_team

Inspect the SQL

CleanShot 2024-01-10 at 15 00 45@2x

Expected Behavior

The user has not selected a button yet, so the input result is null, and returns the expected query results for if '${inputs.my_input}' was null

Actual Behaviour

CleanShot 2024-01-10 at 15 00 45@2x

The query does not return data and so remains in a loading state

Workarounds

Create an {#if} block before the results are available, returning different data. See the source code