preact-mdl icon indicating copy to clipboard operation
preact-mdl copied to clipboard

Slider duplicating on rerender

Open dlaprell opened this issue 8 years ago • 1 comments

When I use the Slider component and a rerender happens (state or props change), then the slider will be duplicated.

Might possibly be the same error source as #7? (A problem with the remounting by mdl)

Minimal setup:

class SliderTest extends Component {
  updateState = e => {
    this.setState({
      value: e.target.valueAsNumber
    })
  }

  render(_, { value }) {
    return (
      <div>
        <Slider name='test' min={0} max={100} value={value} onChange={this.updateState} />
      </div>
    )
  }
}

After some changes will render this:

duplicatingslieders

For an example see here: https://codesandbox.io/s/6wx9r52lw

I will try to tackle this myself as well, but I do not know if my prect / mdl knowledge is enough for that 😅 .

dlaprell avatar Oct 20 '17 15:10 dlaprell

Maybe this is why the onInput callback doesn't seem to work for me? You can drag it a bit but then it hangs.

edit: Jumped the gun, don't think it's related, also I'm not getting this issue.

jon-grangien avatar Feb 01 '18 14:02 jon-grangien