Skip to content

Commit

Permalink
do shift instead of pop
Browse files Browse the repository at this point in the history
  • Loading branch information
Imanpal Singh committed Jun 23, 2022
1 parent b29c17d commit 5ad501f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/rich-text-links/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function addLinksFromRichTextNode(node: Node, links: EntityLinkMaps, type?: stri
const toCrawl: Node[] = [node];

while (toCrawl.length > 0) {
const { data, content, nodeType } = toCrawl.pop() as Block;
const { data, content, nodeType } = toCrawl.shift() as Block;
const hasRequestedNodeType = !type || nodeType === type;

if (hasRequestedNodeType && isLinkObject(data)) {
Expand Down

0 comments on commit 5ad501f

Please sign in to comment.