Self-hosted: live preview on unclaimed subdomains - #1440
Conversation
An unclaimed subdomain showed only a static claim CTA; nothing let the visitor see their own Hive content as a blog before committing. Behind an explicit action (the landing's preview button, or ?preview=1 from a funnel link) the real app now boots against a config synthesized for the host's name: blog or community derived from the hostname, default template, auth disabled outright so every broadcast affordance stays hidden. Entirely in-memory and per-tab; nothing is provisioned and a reload without the param lands back on the CTA. A persistent banner states that this is a preview of public Hive content, carries the claim deep link and an exit, and re-establishes the robots noindex the claim landing removes on unmount, so unclaimed hosts stay out of the index while previewed. Crawlers and casual hits keep getting the lightweight CTA. Closes #1416
Code Review by Qodo
1.
|
PR Summary by QodoSelf-hosted: add live preview mode for unclaimed subdomains
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
|
Warning Review limit reached
Next review available in: 34 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change adds live previews for unclaimed blog and community subdomains. It synthesizes an in-memory configuration, supports automatic or explicit preview entry, renders a persistent claim banner, preserves crawler metadata, and adds tests and translations. ChangesClaim preview flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Visitor
participant ClaimLanding
participant ClaimPreview
participant InstanceConfigManager
participant ClaimPreviewBanner
Visitor->>ClaimLanding: Open unclaimed host with preview=1
ClaimLanding->>ClaimPreview: Enter preview with host and target type
ClaimPreview->>InstanceConfigManager: Apply synthesized preview configuration
InstanceConfigManager-->>ClaimPreviewBanner: Expose active claim preview state
ClaimPreviewBanner->>Visitor: Show preview, claim, and exit actions
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/self-hosted/src/routes/__root.tsx (1)
81-104: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAnnounce preview entry to screen-reader users.
Line 104 mounts the banner only after preview mode starts. Add a
LiveRegionthat mounts during the initial render withmessage={null}. Update its message whenisClaimPreviewbecomes true. Keep the banner controls outside the live region.Based on learnings: In
apps/self-hostedTSX files, useapps/self-hosted/src/features/shared/live-region.tsxfor dynamic screen-reader announcements, keep it mounted from the initial render, and keep interactive controls outside it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/self-hosted/src/routes/__root.tsx` around lines 81 - 104, Add a LiveRegion alongside the preview layout that mounts on the initial render with message={null}, then announces the preview state when isClaimPreview becomes true. Use the shared LiveRegion from live-region.tsx, and keep ClaimPreviewBanner and its interactive controls outside the live region.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/self-hosted/src/core/i18n-strings.ts`:
- Line 387: Update the claim_preview_cta value used by ClaimLanding to use
target-neutral wording that applies equally to blog and community visitors,
removing the blog-specific “Preview this blog first” phrasing.
In `@apps/self-hosted/src/features/claim/claim-landing.tsx`:
- Around line 65-71: Guard the manual preview button around enterClaimPreview so
it cannot be activated when name is empty. Update the button in the claim
landing component to disable or hide it for an empty name, while preserving the
existing preview behavior when a valid name is present.
---
Outside diff comments:
In `@apps/self-hosted/src/routes/__root.tsx`:
- Around line 81-104: Add a LiveRegion alongside the preview layout that mounts
on the initial render with message={null}, then announces the preview state when
isClaimPreview becomes true. Use the shared LiveRegion from live-region.tsx, and
keep ClaimPreviewBanner and its interactive controls outside the live region.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3e592129-acbf-4d65-ac29-e8e3ddd5e140
📒 Files selected for processing (7)
apps/self-hosted/src/core/i18n-strings.tsapps/self-hosted/src/features/claim/claim-landing.tsxapps/self-hosted/src/features/claim/claim-preview-banner.tsxapps/self-hosted/src/features/claim/claim-preview.test.tsapps/self-hosted/src/features/claim/claim-preview.tsapps/self-hosted/src/routes/-internal-links.test.tsapps/self-hosted/src/routes/__root.tsx
Code Review by Qodo
1. Preview likes/comments still render
|
Entering the live preview sets the preview title via applyConfigDom and then unmounts the landing, whose cleanup restored the pre-landing title over it. The cleanup now restores only when no claim preview took over. The other review finding (likes and comments rendering in preview) is by design: counts display read-only while every interactive control gates on the disabled auth flag.
Review finding: on a ?preview=1 deep link the landing's title effect ran after the preview had already painted its own title, sticking the claim headline on the whole preview session. The effect now no-ops when a claim preview is active; the banner owns noindex from there.
Closes #1416.
Visiting an unclaimed subdomain served only a static claim CTA. Behind an explicit action the real app now boots as a live preview of the visitor's own Hive content:
?preview=1boots straight into preview for funnel deep links. Crawlers and casual hits keep the lightweight CTA.templategate flips reactively and the normal route tree renders. Entirely in-memory and per-tab: nothing is provisioned, nothing persisted, reload without the param returns to the CTA.Empty accounts show the app's existing designed empty states. Tests cover the config builder (blog and community shapes, auth off, the marker, the template flag being absent rather than false), the gate flip with DOM paint, strict param parsing and that a real tenant config never reads as a preview. SPA suite 884 tests, typecheck and production build green.
Summary by CodeRabbit