Repository navigation
feat(admin): add live preview for regions and events via sahaj atlas - #579
Merged
Merged
Conversation
Both collections load the Atlas widget's /preview route in the admin Live Preview tab, via a shared atlasLivePreview factory (URL carries collection, id, the preview secret, and the edited locale) with a 390x844 mobile breakpoint for the widget's bottom-sheet drawer layout. Refs #575 Co-Authored-By: Claude Fable 5 <[email protected]>
The Atlas widget fetches drafts client-side, so the live-preview secret header rides a cross-origin browser request and must be in the CORS allow-list. Payload's object form appends to the default header set and keeps origins '*', so Access-Control-Allow-Credentials stays off (#509). Refs #575 Co-Authored-By: Claude Fable 5 <[email protected]>
Unit: atlasLivePreview URL (collection, id, secret, locale) + breakpoint. Int: both collections wire the config; Payload's headersWithCors against the real app config allows the secret header, keeps defaults, and keeps credentials off. Smoke: a real OPTIONS preflight against the deployed preview. Refs #575 Co-Authored-By: Claude Fable 5 <[email protected]>
Pre-existing failure on main: the spec formatted a midnight-UTC instant, which renders as the previous day on machines west of UTC (display is intentionally viewer-local). A zone-less input keeps the rendered day stable in every timezone. Co-Authored-By: Claude Fable 5 <[email protected]>
Drop a needless async on the spec helper and a redundant default-header assertion. Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-579
July 16, 2026 23:48
Destroyed
|
🚅 Deployed to the SahajCloud-pr-579 environment in sahajcloud
|
The atlasLivePreview factory abstracted ~6 lines shared by two adjacent collections while breaking the codebase's inline livePreview pattern (Pages, Meditations, WeMeditateWebConfig) and needing a derived type Payload doesn't export. Inline it like the others; URL-shape coverage moves from the deleted unit spec into the atlas int spec. Refs #575 Co-Authored-By: Claude Fable 5 <[email protected]>
api-clients.md still described cors: '*'; document the object form and why the preview-secret header is allow-listed. Add the two gotchas hit while testing locally: no trailing slash on preview URLs (URL prefix + Origin comparison) and restart-required for the boot-baked CSP frame-src. Co-Authored-By: Claude Fable 5 <[email protected]>
New step 5 before push: sweep the branch diff for stale statements in .claude/rules, .claude/docs, AGENTS.md, DEPLOYMENT.md, .env.example and skill docs, commit updates as their own commit. Pipeline summaries in AGENTS.md and implement-issue updated to match. Co-Authored-By: Claude Fable 5 <[email protected]>
The prose already requires checking skill docs; the copy-paste template omitted the path. Co-Authored-By: Claude Fable 5 <[email protected]>
An unsaved doc has no id, so the preview URL pointed the widget at id=undefined; returning null disables the panel instead (Payload's documented conditional-preview contract). Refs #575 Co-Authored-By: Claude Fable 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-579
July 17, 2026 18:03
Destroyed
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SAHAJATLAS_URL/preview), with a 390×844 mobile breakpoint. Config is inlined per collection, matching the Pages/Meditations pattern.null, disabling the panel until first save.x-sahajcloud-preview-secret: Atlas fetches drafts client-side, so the draft-unlock header rides cross-origin requests and must clear preflight.origins: '*'is kept, soAccess-Control-Allow-Credentialsstays off (feat(usage): enforce CORS + Origin/Referer against Clients.allowedDomains via usagePlugin #509); the object form appends to Payload's default header list.Changes
src/collections/{Events,Regions}— inlineadmin.livePreview(URL + breakpoint + unsaved-doc guard)src/payload.config.ts—cors: '*'→cors: { origins: '*', headers: [PREVIEW_SECRET_HEADER] }tests/e2e/cors-preflight.e2e.spec.ts— real OPTIONS preflight against the Railway preview (verifies the allow-list end-to-end in CI)tests/unit/verification-stage-timeline.spec.ts— fixes a pre-existing failure onmain: the spec formatted a midnight-UTC instant, which renders as the previous day on machines west of UTC; a zone-less input keeps the day stable everywhereapi-clients.mdCORS section updated to the object form;environment.md+.env.exampledocument the no-trailing-slash and restart-for-CSP gotchas;finalize-prskill gains a baked-in docs-sync step (5) before push, withAGENTS.md/implement-issuesummaries alignedTest Results
atlas-collections(7, incl. exact preview-URL + unsaved-doc guard) +cors-config(runs Payload's ownheadersWithCorsagainst the real app config) — all passedManual verification
The CMS side is complete; full iframe behaviour needs the Atlas widget's
/previewroute (sydevs/SahajAtlasWeb#40, PR sydevs/SahajAtlasWeb#54):Notes for reviewer
headersWithCorssource:cors.headersappends to the default allow-list, and credentials are only enabled for a specific-origin list — never fororigins: '*'. Also verified by live preflight against the deployed PR preview.frame-srcalready includesSAHAJATLAS_URL(env-derived innext.config.mjs), so the iframe isn't CSP-blocked — but it's baked at server boot, hence the new restart gotcha in the env docs.private, no-store).Closes #575
🤖 Generated with Claude Code