Repository navigation
fix(blog): enable "See preview" when the blog app omits pageSlug - #7150
Merged
Merged
Conversation
The "See preview" button stayed disabled for blogs generated via blog-manager: the blog app block (`site/apps/deco/blog.ts`) carries no `pageSlug`/`categorySlug` — those props are optional with no upstream default — so `findBlogPageSlug` returned null and the preview URL could never be built. The real post/category routes live in decofile Page blocks (`website/pages/Page.tsx` with a `path`), not on the app block. When the app omits the route props, fall back to those Page blocks: detect the post/category page by its full-page section marker (`BlogPostPage` / `BlogCategoryPage`) and pick the fewest-param match so a paginated variant (`.../page/:page`) never shadows the canonical route. Also accept the pt-BR `:categoria` param used by real sites. The app prop, when present, still wins. Covered with tests using the real bagaggio decofile shapes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Sep 10, 2026
PR: #7150 fix(blog): enable "See preview" when the blog app omits pageSlug Bump type: patch - decocms (apps/api/package.json): 4.351.3 -> 4.351.4 - @decocms/native (apps/native/package.json): 4.351.3 -> 4.351.4 Deploy-Scope: web
2 of 3 tasks
yuriassuncx
added a commit
that referenced
this pull request
Sep 11, 2026
#7150 fixed previewUrl resolution (Page-block fallback when the blog app has no pageSlug/categorySlug) but the button stayed disabled for posts still missing Title/Excerpt/Cover image — fields that have nothing to do with whether the URL can be opened. `disabled={!previewUrl || hasErrors}` conflated two different questions: "can we build a working preview link" (slug + category — already enforced inside buildBlogPostPreviewUrl/applyBlogPageSlug, which return null when either is missing) and "is this post publish-ready" (all 5 fields via missingPostFields, used to gate the Published toggle). Preview only needs the former: a draft with no excerpt/cover image still renders at its URL. `disabled={!previewUrl}` alone already captures the real precondition. The "N problema(s)" badge (still gated on hasErrors, unchanged) keeps warning about missing publish fields — this only stops it from also blocking the unrelated preview button. Co-authored-by: Claude Sonnet 5 <[email protected]>
yuriassuncx
added a commit
that referenced
this pull request
Sep 11, 2026
…earch schemas (#7154) #7151 added contentCollection/contentItem read + selection logic in ContentBrowser (Blog Manager's "Editar no Studio" deep-link), but neither the unified-chat route nor the agents route validateSearch schema declared them. TanStack Router strips any search param a route's validateSearch doesn't declare before the component ever sees it via useSearch — so the redirect landed on an empty content editor instead of the selected post, reproducing exactly what #7151 was meant to fix. Factor the content-editor search params (storefront "." deep-link + Blog Manager deep-link) into one `content-search-params.ts` module spread into both route schemas, so a future param ContentBrowser reads can't silently be dropped by one route and not the other again. The reported "Ver visualização" preview button issue was already fixed on main by #7150 (route derivation) + #7152 (stop gating on unrelated fields) earlier today — not reproducible against current main, just not yet deployed to studio.decocms.com. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
aka-sacci-ccr
pushed a commit
that referenced
this pull request
Sep 11, 2026
One conflict, in the post editor, and it was the interesting kind: both sides had rewritten the same header. The restructure moved the header block below a floating expand/close cluster; upstream changed what's inside it. Kept the restructure's layout and applied upstream's two behaviour changes into it, because taking either side whole would have silently dropped a fix: - #7152 ungated "See preview" from `hasErrors`. The restructure's copy still had `disabled={!previewUrl || hasErrors}`, which is the bug that PR fixes, so the gate is gone and the title no longer branches on it. - #7147 gave `useAutosave` an `isSaving` option so overlapping autosaves stop dropping the penultimate edit. Threaded through, keeping `buildPostBlock` and the three-value destructure the restructure needs for `syncPost` on a block rename. #7150's preview-route fix needed nothing here: the call site is identical on both sides and the change lives in `buildBlogPostPreviewUrl`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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
The "See preview" button in the blog post/category editor stayed permanently disabled for blogs generated via
blog-manager(repro'd on thebagaggioorg). Root cause: the button is gated on a computedpreviewUrl, which was alwaysnullbecausefindBlogPageSlug/findBlogCategorySlugonly read the blog app block'spageSlug/categorySlugprops — and those props are optional with no upstream default, so real sites (bagaggio included) never set them. The blog app block is literally{"__resolveType":"site/apps/deco/blog.ts"}.The actual post/category routes don't live on the app block — they're decofile Page blocks (
website/pages/Page.tsxwith apath, e.g./blog/:slug,/blog/categoria/:categoria). The preview logic simply wasn't looking there.Fix
In
blog-preview-url.ts, when the blog app omitspageSlug/categorySlug, fall back to the decofile Page blocks:BlogPostPagefull-page section marker and the category page byBlogCategoryPage(markers chosen so they never cross-match theBlogPostSeo/BlogCategoryHeaderbody sections)..../page/:page) never shadows the canonical route.:categoriaparam used by real sites (bagaggio's category route is/blog/categoria/:categoria).Testing
bun test .../blog-preview-url.test.ts→ 34 pass. Added coverage for: Page-block fallback for post & category, app-prop precedence, paginated-variant disambiguation, negative cross-match (category page ≠ post page), pt-BR:categoriasubstitution, and an end-to-endbuildBlogPostPreviewUrlfrom a Page block — all using the real bagaggio decofile shapes.tsc --noEmit,oxlint,biomeall clean.Notes / out of scope
lifecycle.previewUrl(the sandbox dev server). If the sandbox/preview is down, the button correctly stays disabled — that's a separate concern from route resolution.titleattribute, which barely surfaces. Converting it to the design-systemTooltipis a worthwhile follow-up but left out to keep this PR focused on the root cause.🤖 Generated with Claude Code
Summary by cubic
Fixes the blog "See preview" button staying disabled when the blog app omits
pageSlug/categorySlug. The preview route now falls back to the decofile Page block that contains the blog post or category page; the app prop still wins when present.:categoriaparam used by real sites.Written for commit db77fc9. Summary will update on new commits.