Skip to content

Commit

Permalink
Further tweak to recursiveDispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefinger committed May 16, 2019
1 parent a85c89d commit 7a69094
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/dispatchers/recursiveDispatcher.ts
Expand Up @@ -3,15 +3,10 @@ import { markActive } from "./helpers/markActive";
import { markDependencies } from "./helpers/markDependencies";
import { shouldApplyValue } from "./helpers/shouldApplyValue";

const hasDependencies = (cell: Cell<any>, first?: true) => {
const hasDependencies = (cell: Cell<any>) => {
markActive(cell);
if (cell.dependents.length) {
if (first) {
markDependencies(cell);
}
markActive(cell);
updateDependencies(cell);
} else {
markActive(cell);
}
};

Expand All @@ -32,6 +27,7 @@ const updateDependencies = <T>(cell: Cell<T>) => {
*/
export const recursiveDispatcher = <T>(cell: Cell<T>, value: T) => {
if (shouldApplyValue(cell, value) && cell.state) {
hasDependencies(cell, true);
markDependencies(cell);
hasDependencies(cell);
}
};

0 comments on commit 7a69094

Please sign in to comment.