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

Slider: ghost knob #179

Open
danielkaxis opened this issue Dec 14, 2021 · 3 comments
Open

Slider: ghost knob #179

danielkaxis opened this issue Dec 14, 2021 · 3 comments
Labels
question Further information is requested

Comments

@danielkaxis
Copy link
Collaborator

When continuously saving to an api while dragging the slider, some requests can take a while before seeing visible changes. I wonder if we can implement a ghost knob or something similiar that is displaying the actual value/position.

Workflow could be something like
-> Save value
-> Get data from a subscription
-> The standard knob is displaying the value we saved
-> The ghost knob is displaying the subscription data
-> The ghost knob disappears when reaching the standard knob position

@danielkaxis danielkaxis added the question Further information is requested label Dec 14, 2021
@lekoaf
Copy link
Member

lekoaf commented Dec 14, 2021

Wouldn't the answer to this lie in your own code?

Save the value to a state and debounce api saving?

const MyComponent = ({ initalValueFromApi }) => {
  const [value, setValue] = useState(initalValueFromApi)

  const changeCb = useCallback((val) => {
    setValue(val)

    const timeout = setTimeout(() => {
      // save to api
    }, 500)
  }, [])

  return <Slider value={value} onChange={changeCb} />
}

Not complete code, but you get the gist of it.

@danielkaxis
Copy link
Collaborator Author

Sorry, I meant more like this. It can be some mechanics that needs time to reach the value that we saved. That would mean creating that ghost knob. But the user gets feedback that something is happening.
Ghost slider

@boilund
Copy link
Collaborator

boilund commented Jan 27, 2022

Material UI has two kinds of onChange props. If we implement this as well then the feature can be interesting.
Screenshot from 2022-01-27 09-52-53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants