fix(web): add code, comment fixes from PR review

This commit is contained in:
Joshua Horton 2026-02-16 09:34:00 +07:00
parent 1755556a20
commit c6e492313b
2 changed files with 10 additions and 4 deletions

View file

@ -195,9 +195,15 @@ export class SearchQuotientCluster implements SearchQuotientNode {
return false;
}
// We need to check if the parents match. Done naively in the manner below, this is O(N^2).
// Granted, we shouldn't have _that_ many incoming paths.
if(this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
// We need to check if the parents match.
// First, is the parent count the same?
if(this.parents.length != space.parents.length) {
return false;
} else if (this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
// Done naively in the manner above, checking each pair of nodes, to
// ensure a match is found for each, is O(N^2).
//
// Granted, we shouldn't have _that_ many incoming paths.
return false;
}

View file

@ -497,7 +497,7 @@ export abstract class SearchQuotientSpur implements SearchQuotientNode {
}
isSameNode(space: SearchQuotientNode): boolean {
// Easiest cases: when the instances or their ' `spaceId` matches, we have
// Easiest cases: when the instances or their `spaceId` matches, we have
// a perfect match.
if(this == space || this.spaceId == space.spaceId) {
return true;