Skip to content

fix(editor): apply empty-folder explorer ops without the "0 paths" dialog#142

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/explorer-empty-folder-ops
Jul 1, 2026
Merged

fix(editor): apply empty-folder explorer ops without the "0 paths" dialog#142
DavidBabinec merged 1 commit into
mainfrom
fix/explorer-empty-folder-ops

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What changed

Renaming, moving, or deleting an empty structural folder (pages / styles / scripts) in the Site Explorer no longer pops the "This will rewrite 0 paths" confirmation dialog. Those operations rewrite no page slugs or file paths, so they now apply directly. The dialog still appears whenever there is something to review — real slug/path rewrites, or a blocker to explain.

Why

Two problems, one screenshot:

  1. Pointless dialog. Renaming an empty folder showed a confirm dialog reading "This will rewrite 0 paths in Pages" with a generic "Raw URLs in authored content are not rewritten" warning — friction with nothing to confirm.
  2. Silent no-op underneath. The confirm-plan commit only rewrote pages[].slug / files[].path. An empty folder's path lives in the section bookkeeping (emptyFolders / expandedFolders / rowOrder), which the commit never touched. So even after clicking Apply, the empty folder was not renamed/deleted — the operation did nothing.

Fixing only the UI (hiding the dialog) would have made the silent no-op worse, so both are fixed at the source.

How

  • Core — src/core/page-tree/explorerPathPlans.ts

    • Rewrite plans now carry a folderPathChange { from, to }; delete plans carry the removed folderPath.
    • commit rewrites/removes the emptyFolders / expandedFolders / rowOrder references so empty-folder rename/move/delete actually persist. Non-empty folder renames route through the same rewrite, which also preserves their expansion + ordering (previously lost to the reconcile pruning pass).
  • UI — src/admin/pages/site/panels/SiteExplorerPanel/SiteExplorerPanel.tsx

    • A single presentStructuralPathPlan interception applies a plan directly when it has no blockers and rewrites 0 content paths; otherwise it opens the dialog. Covers inline rename, context-menu delete, and drag-drop moves through one code path.

Tests

  • Core unit tests: empty-folder rename (with nested descendant), empty-folder move under a new parent, non-empty rename preserves expansion/order, empty-folder delete removes bookkeeping with no descendant items.
  • End-to-end store tests (preview → commit → reconcile) for a freshly-created (collapsed) empty folder rename and delete.

Verification

  • bun run build
  • bun run lint
  • bun test src/__tests__/site-explorer/ src/__tests__/panels/ ✓ (all pass)

Pre-existing icon-catalog-integrity architecture failures are environmental (the vendored pixel-art-icons/dist is not built in this worktree) and unrelated to this change.

🤖 Generated with Claude Code

…alog

Renaming, moving, or deleting an empty structural folder (pages/styles/
scripts) rewrites no page slugs or file paths, yet it surfaced the Site
Explorer confirmation dialog reading "This will rewrite 0 paths" plus a
generic warning — pure friction with nothing to review.

Worse, the confirm-plan commit only rewrote page/file paths and ignored the
section bookkeeping (emptyFolders/expandedFolders/rowOrder), where an empty
folder's path actually lives. So the "0 paths" rename/delete was a silent
no-op: you confirmed and nothing changed.

Fix both at the source:

- Core (explorerPathPlans.ts): rewrite plans carry the folder-path change and
  delete plans carry the removed folderPath. commit now rewrites/removes the
  emptyFolders/expandedFolders/rowOrder references so empty-folder rename/move/
  delete persist. Non-empty folder renames route through the same rewrite,
  which also keeps their expansion + ordering instead of losing it to the
  reconcile pruning pass.

- UI (SiteExplorerPanel.tsx): a single presentStructuralPathPlan interception
  applies a plan directly when it has no blockers and rewrites 0 content paths;
  otherwise it opens the dialog. Covers inline rename, context-menu delete, and
  drag-drop moves.

Verification: bun run build, bun run lint, and the site-explorer + panels test
suites all clean; added core + end-to-end store tests for empty folder
rename/move/delete bookkeeping. Pre-existing icon-catalog architecture failures
are environmental (vendored pixel-art-icons dist not built in this worktree)
and unrelated to this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DavidBabinec
DavidBabinec marked this pull request as ready for review July 1, 2026 13:49
@DavidBabinec
DavidBabinec merged commit 40e28e1 into main Jul 1, 2026
6 checks passed
@DavidBabinec
DavidBabinec deleted the fix/explorer-empty-folder-ops branch July 1, 2026 13:49
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.

1 participant