Skip to content

Commit

Permalink
Prevent observers without nodes from being fired
Browse files Browse the repository at this point in the history
  • Loading branch information
davidr64 committed Feb 23, 2024
1 parent 946c26f commit 10b46f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mocks/intersection-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export class MockedIntersectionObserver implements IntersectionObserver {
}

triggerNodes(nodeDescriptions: NodeIntersectionDescription[]) {
if (nodeDescriptions.length === 0) return;

const nodeIndexes = nodeDescriptions.map(({ node }) =>
findNodeIndex(this.nodes, node)
);
Expand Down

0 comments on commit 10b46f9

Please sign in to comment.