EEGEdu
EEGEdu copied to clipboard
The sliders last value is not used to update the charts, but the value before that, callback race problem
Describe the bug When adjusting sliders, the data shows the second to last values selected, instead of the last
To Reproduce Go to raw data, adjust sliders,
Expected behavior should update charts to newest possible settings
I think it is a race problem where the callback is not complete at setting the new settings before the pipe gets recreated with the old settings, similar to this problem: https://stackoverflow.com/questions/30550314/react-input-range-slider-not-propagating-last-value-to-its-owner-in-chrome
function handleIntervalRangeSliderChange(value) {
setSettings(prevState => ({...prevState, interval: value}));
resetPipeSetup();
}
so resetPipeSetup() runs before setSettings is done, I tried something like this but setSettings can only have one callback:
function handleIntervalRangeSliderChange(value) {
setSettings(prevState => ({...prevState, interval: value}), function () {
resetPipeSetup();
});
}