Repository navigation
fix(blog): stop gating "See preview" on unrelated content fields - #7152
Merged
Merged
Conversation
#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
deleted the
fix/post-preview-not-gated-on-content-fields
branch
September 11, 2026 00:07
decocms Bot
pushed a commit
that referenced
this pull request
Sep 11, 2026
PR: #7152 fix(blog): stop gating "See preview" on unrelated content fields Bump type: patch - decocms (apps/api/package.json): 4.353.1 -> 4.353.2 - @decocms/native (apps/native/package.json): 4.353.1 -> 4.353.2 Deploy-Scope: web
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.
Problem
After #7150 (previewUrl route-resolution fix), "Ver visualização" still
shows disabled for some posts — e.g. Bagaggio's "Mochila Escolar..." draft,
which shows a red "1 problema" badge.
Root cause
#7150fixed the right thing (previewUrl couldn't be built at all before),but the button's disabled condition was never just about the URL:
hasErrorscomes frommissingPostFields()— Title, Slug, Category,Excerpt, Cover image. Slug/Category are already covered: when either is
missing,
buildBlogPostPreviewUrl→applyBlogPageSlugalready returnsnull, sopreviewUrlitself is falsy. But Title/Excerpt/Cover image havezero bearing on whether the URL resolves — a draft missing its excerpt still
renders fine at its route. Gating preview on them conflates "is this
publish-ready" (correct place: the Published toggle, via
blocksPostStatus) with "can we open a preview link" (only needsslug+category, i.e.
previewUrl).So once #7150 made
previewUrlresolve correctly, the button stillstayed disabled for any post missing excerpt/cover image/title — same
symptom, different, independent gate.
Fix
disabled={!previewUrl}. The "N problema(s)" badge next to Saved isuntouched (still
hasErrors-gated) — it keeps nudging towardpublish-readiness. This only stops it from also blocking the unrelated
preview button.
Test plan
tsc --noEmit(apps/web) cleanbun test blog-preview-url.test.ts— 34 pass (unchanged, this PRdoesn't touch URL-building, only the button's gate)
in the report) and confirm "Ver visualização" is now clickable
Related
Follow-up to #7150 (Daniel Furtado) — same investigation thread as #7151
and spire-agent#12.
Co-Authored-By: Claude Sonnet 5 [email protected]
Summary by cubic
Fixes the blog post preview button so it's no longer disabled by content fields that don't affect the preview URL. Previously, drafts missing Title, Excerpt, or Cover image kept the button disabled even though only Slug and Category determine whether the URL resolves.
Bug Fixes
previewUrl; the "N problema(s)" badge still useshasErrorsand is unchanged.Written for commit de0e103. Summary will update on new commits.