Skip to content

fix: redirect /edit to /canvas when Experience Workspace is enabled - #1290

Merged
mhaack merged 3 commits into
mainfrom
ewredir
Sep 4, 2026
Merged

fix: redirect /edit to /canvas when Experience Workspace is enabled#1290
mhaack merged 3 commits into
mainfrom
ewredir

Conversation

@mhaack

@mhaack mhaack commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

/edit now always checks whether Experience Workspace is enabled — either via the user's personal opt-in (the nx2:ew-user-enabled localStorage flag) or the site-level ew.enabled config flag — and if either is set, redirects straight to /canvas instead of loading the old editor.

This closes the gap where landing on /edit (e.g. via a Sidekick "Edit" click, which targets /edit regardless of the user's preference) would silently show the old editor even though the user had opted into the new one.

Implementation: setUI() in blocks/edit/edit.js awaits isEWEnabled({ org, site }) (from da-nx's nx2/utils/ewFlags.js, which itself checks the user flag first and falls back to the site flag) right after resolving path details, and redirects before any old-editor doc-fetch/websocket work starts.

Pairs with adobe/da-nx#714, which stops the toggle from clearing the user's localStorage flag when Sidekick lands you on /edit — without that fix, this redirect would rarely fire since the flag would already be cleared by the time you got here.

Fixes #1289

How Has This Been Tested?

Combine this branch with the companion da-nx branch via the ?nx=togglefix override:

https://ewredir--da-live--adobe.aem.live/edit?nx=togglefix#/aem-sandbox/block-collection/index

  1. Toggle "New Authoring" on (nav switch on /edit, or profile menu on /canvas) — you land on /canvas.
  2. Re-visit the /edit#... URL above directly (simulating Sidekick bouncing you back to /edit) — you're redirected straight back to /canvas instead of seeing the old editor.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.

setUI() now checks isEWEnabled (user localStorage flag or site-level
ew.enabled config) right after resolving path details, and redirects
to /canvas before any old-editor doc-fetch/websocket work starts.

Part of #1289.
@aem-code-sync

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

sharanyavinod
sharanyavinod previously approved these changes Sep 2, 2026
Comment thread blocks/edit/edit.js Outdated
const details = getPathDetails();
if (!details) return;

const { isEWEnabled } = await getNxEWFlags();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we're gating the whole editor load on two awaits now. if getNxEWFlags/isEWEnabled rejects (flag service blip), does /edit just break? might want a try/catch that falls through to the normal editor so a flag failure doesn't take down editing.

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 — wrapped both awaits in a try/catch in e7c3145. On failure it now falls through to the normal editor instead of breaking /edit.

getNxEWFlags()/isEWEnabled() can reject (da-nx module load failure,
config fetch blip), which would otherwise throw out of setUI() and
break /edit entirely instead of just skipping the redirect.
@mhaack
mhaack merged commit 40b968c into main Sep 4, 2026
4 of 5 checks passed
@mhaack
mhaack deleted the ewredir branch September 4, 2026 14:31
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] New editor toggle setting not persisted across .page → edit roundtrip

3 participants