Fix branchedResetPropagation #57
1 changed files with 6 additions and 6 deletions
|
@ -339,19 +339,19 @@ export const branchedResetPropagation = function (
|
|||
resettingNode: GenericTreeNode
|
||||
): void {
|
||||
const links = unref(tree.branches);
|
||||
if (links === undefined) return;
|
||||
let reset: GenericTreeNode[] = [];
|
||||
if (links == null) return;
|
||||
|
||||
const reset: GenericTreeNode[] = [];
|
||||
let current = [resettingNode];
|
||||
while (current.length != 0) {
|
||||
let next: GenericTreeNode[] = [];
|
||||
for (let node of current) {
|
||||
for (let link of links.filter(link => link.startNode === node)) {
|
||||
const next: GenericTreeNode[] = [];
|
||||
thepaperpilot
commented
The linter says next, node, and link should all be The linter says next, node, and link should all be `const`
nif
commented
that's probably because i use that's probably because i use `Array.prototype.concat` and `Array.prototype.push` instead of reassigning them
|
||||
for (const node of current) {
|
||||
for (const link of links.filter(link => link.startNode === node)) {
|
||||
if ([...reset, ...current].includes(link.endNode)) continue
|
||||
next.push(link.endNode);
|
||||
link.endNode.reset?.reset();
|
||||
}
|
||||
};
|
||||
reset = reset.concat(current);
|
||||
reset.push(...current);
|
||||
thepaperpilot
commented
This line is fine, but I wonder why you don't just This line is fine, but I wonder why you don't just `push` like you do the `next` array.
nif
commented
because then that gives a shaped array that can't be iterated over as well because then that gives a shaped array that can't be iterated over as well
nif
commented
wait no i could have wait no i could have `.push(...`'ed
|
||||
current = next;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue
instead of
=== undefined
, can you use== null
? That matches the rest of the codebase and has subtly different behavior.You very well could, I didn't realise that
== null
tested forundefined