publ-echo-test 0.0.98 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -452,23 +452,30 @@ export var findAccessibleChildrenBlocks = function (blockStructure, targetGroupI
452
452
  return [];
453
453
  }
454
454
  var result = new Set();
455
- var traverse = function (children) {
456
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
457
- var child = children_1[_i];
458
- if (blockIds.includes(child.blockId)) {
459
- result.add(child.blockId);
460
- }
461
- else if ('children' in child && child.children) {
462
- var hasMatch = child.children.some(function (grandChild) {
463
- return blockIds.includes(grandChild.blockId);
464
- });
465
- if (hasMatch) {
466
- result.add(child.blockId);
455
+ var traverse = function (block) {
456
+ if ('children' in block && block.children) {
457
+ for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
458
+ var child = _a[_i];
459
+ if (blockIds.includes(child.blockId)) {
460
+ result.add(block.blockId);
461
+ return true; // Stop traversal for this branch
462
+ }
463
+ if (traverse(child)) {
464
+ result.add(block.blockId);
465
+ return true; // Stop traversal for this branch
467
466
  }
468
- traverse(child.children); // Continue traversing deeper
469
467
  }
470
468
  }
469
+ return false;
471
470
  };
472
- traverse(targetBlock.children);
471
+ for (var _i = 0, _a = targetBlock.children; _i < _a.length; _i++) {
472
+ var child = _a[_i];
473
+ if (blockIds.includes(child.blockId)) {
474
+ result.add(child.blockId);
475
+ }
476
+ else {
477
+ traverse(child);
478
+ }
479
+ }
473
480
  return Array.from(result);
474
481
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",