Skip to content

fix: count folder contents for delete on Helix 6 (#1034)#1048

Closed
chrischrischris wants to merge 1 commit into
mainfrom
delfldr
Closed

fix: count folder contents for delete on Helix 6 (#1034)#1048
chrischrischris wants to merge 1 commit into
mainfrom
delfldr

Conversation

@chrischrischris

Copy link
Copy Markdown
Contributor

Problem

Fixes #1034.

On a Helix 6 site, deleting a folder from the browse UI shows a confirmation dialog asking to confirm the deletion of 0 items (and the flow is confusing/broken).

Root cause

handleDelete counts the files inside a selected folder by crawling it. That crawl used nx's crawl helper (tree.js), which lists only against the DA origin (${DA_ORIGIN}/list). On a Helix 6 site the content lives behind a different backend, so the crawl found nothing → _deleteCount came back 0.

Every other listing in da-list.js already uses source.list, which is backend-aware (isHlx6() routes to the correct origin for both the legacy DA and Helix 6 backends).

Fix

  • blocks/browse/da-list/helpers/utils.js — add crawlDeleteCount, a recursive file-counter built on the backend-aware source.list. It paginates via the continuation token, recurses into subfolders with bounded concurrency, and exposes the same { results, cancelCrawl } shape the old crawl had.
  • blocks/browse/da-list/da-list.jshandleDelete now calls crawlDeleteCount with the nx2 source instead of nx's DA-only crawl. Cancellation (cancelCrawl) and the mid-crawl bail-out checks are preserved unchanged.
  • test/unit/blocks/browse/helpers/helpers.test.js — new tests: recursive counting, standalone-file inclusion, pagination, cancellation stops recursion, and graceful handling of a non-ok listing.

The actual deletion already worked (it uses backend-aware source.delete/source.move) — only the confirmation count was broken. This now works for both backends.

Testing

  • Helper unit tests: 16 passed (5 new)
  • da-list unit tests: 99 passed
  • eslint on changed files: clean

🤖 Generated with Claude Code

…1034)

The delete confirmation crawled folder contents using nx's `crawl`, which
lists against the DA origin only. On Helix 6 sites it found nothing, so the
dialog reported "0 items" and the delete flow was confusing/broken.

Replace the crawl with `crawlDeleteCount`, a recursive count built on the
backend-aware `source.list` (the same API the listing uses), so it works for
both the legacy DA and Helix 6 backends. Preserves cancellation semantics
(cancelCrawl) and pagination handling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jun 24, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@chrischrischris chrischrischris marked this pull request as draft June 25, 2026 15:07
@chrischrischris

Copy link
Copy Markdown
Contributor Author

Closing in favor of the proper fix at the shared layer: adobe/da-nx#555 makes nx2's crawl backend-aware via source.list, so da-live needs no change — its existing call to nx crawl will work on Helix 6 once that ships. This avoids reimplementing folder traversal in da-live just for the delete count.

@chrischrischris chrischrischris deleted the delfldr branch June 25, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[hlx6] Delete folder from the browse UI doesn't work

1 participant