fix(sdk): stop leaking UVE edit-mode data-dot-* attributes into live pages (#36095)#36288
Conversation
…pages (#36095) The React, Angular and JS SDKs share rendering logic that always emitted the full set of UVE editor metadata (data-dot-object, data-dot-identifier, data-dot-container, data-dot-uuid, etc.) on container and contentlet wrappers, even when a page is served in live mode. This bloats the public markup and leaks internal identifiers. Live mode now strips this metadata: - Container wrappers emit no data-dot-* attributes outside edit mode. - Contentlet wrappers emit nothing by default; only when DotCMS Analytics is active do they keep the minimal set it needs to identify content (data-dot-identifier/inode/title/type/basetype) plus the dotcms-contentlet class, per Arcadio's heads-up. The dotcms:analytics:ready event is observed so attributes appear regardless of analytics init order. - Edit mode (UVE) is unchanged and still emits the full attribute set. Shared helpers (getAnalyticsContentletAttributes, isDotAnalyticsActive) and constants live in @dotcms/uve so all SDKs stay in sync. Adds regression tests across uve, react and angular. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @zJaaal's task in 1m 41s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackAll 17 changed files are confined to frontend SDK packages under
No unsafe categories match:
The changes are purely frontend SDK output changes — they alter which HTML attributes are rendered client-side based on rendering mode (edit vs. live). Rolling back to the previous release restores the prior attribute-emission behavior with no data loss, no reindexing, and no backend impact. Label added: AI: Safe To Rollback |
🤖 Bedrock Review —
|
🤖 Bedrock Review —
|
|
Re: the two automated Bedrock reviews (deepseek + qwen) — I went through every finding against the committed code; none are actionable. Summary:
— posted by Claude on behalf of @zJaaal |
|
Tick the box to add this pull request to the merge queue (same as
|
Proposed Changes
Fixes #36095 — the dotCMS SDKs (React, Angular, JS) shared rendering logic that always emitted the full set of UVE editor metadata onto container and contentlet wrappers, so
data-dot-*attributes leaked into live / production output. This bloats public markup and exposes internal identifiers.Behavior by mode
data-dot-objectdata-dot-identifier/inode/title/type/basetype+dotcms-contentletclassdata-dot-*The Analytics carve-out follows Arcadio's heads-up: impression/click tracking needs the content's identifying attributes (and the
dotcms-contentletclass) in live mode. Gating is driven bywindow.__dotAnalyticsActive__, and the SDKs observe thedotcms:analytics:readyevent so attributes appear regardless of analytics initialization order. No new customer configuration required.Implementation
@dotcms/uve(shared):getAnalyticsContentletAttributes()(minimal set),isDotAnalyticsActive(), andANALYTICS_ACTIVE_WINDOW_KEY/ANALYTICS_READY_EVENTconstants — kept in sync with@dotcms/analytics.@dotcms/react:Contentlet/Containergate attributes by mode; newuseIsAnalyticsActivehook reacts to the ready event.@dotcms/angular: contentlet/container use reactive host bindings;DotCMSStoreexposes$isAnalyticsActivederived from the ready event viafromEvent+toSignal(noNgZonejuggling; safe on the SDK's min Angular>=17).@dotcms/types:DotAnalyticsContentletAttributes.Angular
Screen.Recording.2026-06-23.at.1.copy.mp4
NextJS
Screen.Recording.2026-06-23.at.1.mp4
Testing
sdk-uve,sdk-react,sdk-angularcovering all three modes (edit / live-no-analytics / live-with-analytics) —nx run-many -t test lintgreen for all four projects.data-dot-*in live mode; the minimal content attributes reappear when analytics activates; full set returns in UVE edit mode.🤖 Generated with Claude Code
This PR fixes: #36095