Skip to content

Fix Umbraco V18 Backoffice Compatibility#184

Draft
JBoye wants to merge 1 commit into
AaronSadlerUK:developfrom
JBoye:develop
Draft

Fix Umbraco V18 Backoffice Compatibility#184
JBoye wants to merge 1 commit into
AaronSadlerUK:developfrom
JBoye:develop

Conversation

@JBoye

@JBoye JBoye commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

In Umbraco V18 DocumentVariantStateModel.Draft was renamed to PublishableVariantStateModel.Draft

This PR uses an fixed enum to keep it compatible with both v17 and v18

Copilot AI review requested due to automatic review settings June 17, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates draft/publish detection for documents by replacing a backend API enum check with a string-based state comparison.

Changes:

  • Removed DocumentVariantStateModel import.
  • Introduced DRAFT_VARIANT_STATE = "Draft" constant.
  • Switched isPublished logic to compare documentVariant.state (stringified) against the draft constant in two places.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api";
import { DocumentVariantStateModel } from "@umbraco-cms/backoffice/external/backend-api";

const DRAFT_VARIANT_STATE = "Draft";
let documentVariant = document?.variants?.[0];
const documentName = documentVariant?.name ?? null;
isPublished = documentVariant?.state != DocumentVariantStateModel.DRAFT
isPublished = String(documentVariant?.state) !== DRAFT_VARIANT_STATE
let documentVariant = document?.variants?.[0];
const documentName = documentVariant?.name ?? null;
isPublished = documentVariant?.state != DocumentVariantStateModel.DRAFT
isPublished = String(documentVariant?.state) !== DRAFT_VARIANT_STATE
@JBoye JBoye marked this pull request as draft June 17, 2026 08:40
@JBoye JBoye changed the title Fix Umbraco V18 Compatibility Fix Umbraco V18 Backoffice Compatibility Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants