Skip to content

Commit

Permalink
Merge pull request #1315 from developit/keep-options-debouncerendering
Browse files Browse the repository at this point in the history
Keep options.debounceRendering
  • Loading branch information
developit authored Mar 4, 2019
2 parents 29c92e5 + b421460 commit e7a9ce2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assign } from './util';
import { diff, commitRoot } from './diff/index';
import options from './options';
import { Fragment } from './create-element';

/**
Expand Down Expand Up @@ -124,7 +125,7 @@ const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.r
*/
export function enqueueRender(c) {
if (!c._dirty && (c._dirty = true) && q.push(c) === 1) {
(Component.debounce || defer)(process);
(options.debounceRendering || defer)(process);
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/_util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function setupScratch() {
* @returns {() => void}
*/
export function setupRerender() {
Component.__test__previousDebounce = Component.debounce;
Component.debounce = cb => Component.__test__drainQueue = cb;
Component.__test__previousDebounce = options.debounceRendering;
options.debounceRendering = cb => Component.__test__drainQueue = cb;

return () => Component.__test__drainQueue && Component.__test__drainQueue();
}
Expand Down Expand Up @@ -55,7 +55,7 @@ export function teardown(scratch) {
}

if (typeof Component.__test__previousDebounce !== 'undefined') {
Component.debounce = Component.__test__previousDebounce;
options.debounceRendering = Component.__test__previousDebounce;
delete Component.__test__previousDebounce;
}

Expand Down

0 comments on commit e7a9ce2

Please sign in to comment.