Material-ui: [Slider] does not update state value if min, max, value props are changed together

Created on 21 Nov 2017  路  5Comments  路  Source: mui-org/material-ui


Slider does not update self state value if min, max, value props are changed together, so slider gets out of the page layout.
2017-11-21 17 57 58

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior


When I change the slider props, I believe that the slider accepts new props, updates its state and re renders properly.

Current Behavior


If I change min, max, value props together, slider does not update value.

2017-11-21 17 51 01

Steps to Reproduce (for bugs)


Bug demo: https://codesandbox.io/s/xrl2j6936o (Press "Do a bug" button)

  1. Set slider props - value: 5, minValue: 1, maxValue: 10, step: 1
  2. Change slider props to - minValue: 25, maxValue: 30, value: 27
  3. See that slider's value did not change

Context


I've got slider as a part of big component, that present a service calculator. User can switch different mode, so the slider must change it props.

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI |0.19.4|
| React |tried with 15.4.0 and 16.0.0|
| browser |Google Chrome 62.0.3202.94, Firefox 57, IE11, EDGE and others|

bug 馃悰 Slider v0.x

All 5 comments

@Bobinhos We are focusing our efforts on v1-beta, but I'll leave this open for now since the Slider isn't ported yet. Your quickest route to get this fixed would be to dig in and submit a PR.

the new value was restricted to the old min/max in componentWillReceiveProps. I hope my PR fixes the bug.

Fixed by #9261

I still ran into similar issues when assigning tmin and tmax dynamically. The slider would become undraggable unless a fixed set of range is provided.

@shandou Please open a separate issue and follow fill out the issue template

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbozan picture rbozan  路  3Comments

pola88 picture pola88  路  3Comments

ericraffin picture ericraffin  路  3Comments

newoga picture newoga  路  3Comments

reflog picture reflog  路  3Comments