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

[Bug]: Slider can't accept dynamic defaultValue #2539

Open
Ash-Woods opened this issue Sep 13, 2024 · 2 comments
Open

[Bug]: Slider can't accept dynamic defaultValue #2539

Ash-Woods opened this issue Sep 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Ash-Woods
Copy link

Ash-Woods commented Sep 13, 2024

Describe the bug

I am attempting to pass a dynamic defaultValue on a Slider so that users can adjust the value as needed from a more configurable position, rather than solely starting at 0. I am using the below code:

<Slider
    title="Median Days" 
    name=days_slider
    min=0
    max={max_flow_time_median_days[0].max_value}
    defaultValue={max_flow_time_median_days[0].max_value}
/>

and it continues to default at 0.

image (13)

Steps to Reproduce

Create the query, then create the Slider. Once complete, load the page in dev mode and it navigate to the rendered component on the screen.

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 185.11 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - /usr/local/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.5.2 - /usr/local/bin/npm
    Watchman: 2024.08.26.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 128.0.6613.120
    Safari: 17.5
  npmPackages:
    @evidence-dev/bigquery: ^2.0.7 => 2.0.7 
    @evidence-dev/core-components: ^4.7.5 => 4.7.5 
    @evidence-dev/csv: ^1.0.12 => 1.0.12 
    @evidence-dev/databricks: ^1.0.7 => 1.0.7 
    @evidence-dev/duckdb: ^1.0.11 => 1.0.11 
    @evidence-dev/evidence: ^39.1.4 => 39.1.4 
    @evidence-dev/motherduck: ^1.0.2 => 1.0.2 
    @evidence-dev/mssql: ^1.0.9 => 1.0.9 
    @evidence-dev/mysql: ^1.1.3 => 1.1.3 
    @evidence-dev/postgres: ^1.0.6 => 1.0.6 
    @evidence-dev/snowflake: ^1.1.1 => 1.1.1 
    @evidence-dev/sqlite: ^2.0.6 => 2.0.6 
    @evidence-dev/trino: ^1.0.8 => 1.0.8 
    evidence-connector-aws-athena: ^1.2.0 => 1.2.0

Severity

annoyance

Additional Information, or Workarounds

No response

@Ash-Woods Ash-Woods added bug Something isn't working to-review Evidence team to review labels Sep 13, 2024
@archiewood archiewood removed the to-review Evidence team to review label Sep 16, 2024
@ItsMeBrianD
Copy link
Member

This is an interesting use-case for the slider, thanks for filing this!

I would propose that the Slider accept some props like this:

<Slider
    title="Median Days" 
    name=days_slider
    data={max_flow_time_median_days}
    min=0
    maxColumn=max_value
    defaultValue=max_value
/>

This ties it to a query, and makes it a little more intuitive to update the defaultValue after the slider has already been rendered (and potentially interacted with).

@Ash-Woods
Copy link
Author

Thanks @ItsMeBrianD , that sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants