Skip to content

feat(assets): preserve last folder between asset picker openings - #1346

Open
shsteimer wants to merge 6 commits into
mainfrom
lastpath
Open

shsteimer wants to merge 6 commits into
mainfrom
lastpath

Conversation

@shsteimer

@shsteimer shsteimer commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What changed

buildAssetSelectorProps now passes a path prop to the AEM asset selector, set to the folder of the last selected asset. rememberAssetFolder (in blocks/shared/aem-assets/selector-props.js) captures that folder in buildHandleSelection, shared by both /edit and /canvas. Only applies to author-tier repos — delivery tier has no folder structure.

Why

Author feedback: the picker always reopened at the DAM root, forcing re-browsing (or search) for every asset inserted into a page. Remembering the last folder for the editor session avoids that.

Reviewer notes

State is in-memory (module-level var), scoped to the page session — resets on reload, not persisted. Only captured on actual selection; browsing-then-canceling isn't tracked, since the assets-selectors.js library exposes no folder-navigation callback.

Fixes #1345

https://lastpath--da-live--adobe.aem.live/

Author-tier picker always reopened at the DAM root, forcing re-browsing
for every asset on a page. Remember the folder of the last selected
asset in-memory and pass it back as the selector's `path` prop.
Delivery-tier repos have no folder structure, so skipped there.

Fixes #1345

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

aem-code-sync Bot commented Sep 16, 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

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
return features;
}

let lastFolderPath;

@mhaack mhaack Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lastFolderPath is a single module-level var, not scoped per repo. The PR description says this is "scoped to the page session — resets on reload," but edit.js:87-89,146 shows navigation is handled via hashchange without a full reload, so the description doesn't match actual behavior: switching orgs/sites in the same tab carries the remembered folder over into an unrelated repo's asset picker. Affects both /edit and /canvas (both route through this shared module).

Fix: key lastFolderPath by repoConfig.repositoryId instead of a flat variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, updated

shsteimer and others added 2 commits September 22, 2026 08:09
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
lastpath — 35041bd0 Deployed Oct 2, 2026 by aem-code-sync[bot]
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.

[ew] Preserve path between subsequent opening of the AEM asset picker

2 participants