allow disabling force-update and debounce by knob options

This commit is contained in:
Vladimir Novikov 2020-01-19 01:27:34 +03:00 committed by GitHub
parent 967a3e9a27
commit 9fea73ab4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,9 +22,7 @@ function setPaneKnobs(timestamp: boolean | number = +new Date()) {
const resetAndForceUpdate = () => {
knobStore.markAllUnused();
if (!manager.options.disableForceUpdate) {
forceReRender();
}
forceReRender();
};
// Increase performance by reducing how frequently the story is recreated during knob changes
@ -39,10 +37,12 @@ function knobChanged(change: KnobStoreKnob) {
const knobOptions = knobStore.get(name);
knobOptions.value = value;
if (!manager.options.disableDebounce) {
debouncedResetAndForceUpdate();
} else {
resetAndForceUpdate();
if (!manager.options.disableForceUpdate && !knobOptions.disableForceUpdate) {
if (!manager.options.disableDebounce && !knobOptions.disableDebounce) {
debouncedResetAndForceUpdate();
} else {
resetAndForceUpdate();
}
}
}