Work with apps in Release context
This guide explains how to ensure your apps work correctly when entries are being edited within a release context, and how to implement opt-out mechanisms when your app is not compatible with releases.
Overview
Contentful’s Timeline feature allows content editors to manage, preview, and schedule changes to a batch of entries. When an entry is being edited within a release context, some apps may encounter compatibility issues or need to adjust their behavior.
This guide provides practical solutions for handling release contexts in your apps, including opt-out mechanisms for apps that cannot function properly within releases.
Understanding Release Context
When a content editor works with entries in a release, they’re editing a release version of the entry that exists separately from the main entry. This has several implications for apps:
- All entry data and references (including
sdk.entry) are scoped to the release context, not the base entries - Some SDK methods like
publish()andunpublish()are not available because the release itself manages the publishing state of all included entries - The
sdk.releaseattribute contains information about the current release
Detecting Release Context
The primary way to detect whether your app is running in a release context is by checking the sdk.release attribute:
Release Object Structure
When in release context, sdk.release contains the following information:
When not in release context, sdk.release will be undefined.
Opt-out patterns
There are several approaches you can take when your app encounters a release context:
Complete opt-out
The simplest approach is to render nothing when in release context:
Partial opt-out with fallback UI
Show a user-friendly message explaining why the app is not available:
Conditional feature disabling
Disable specific features while keeping the app partially functional:
Affected App Locations
Apps in the following locations are affected by release contexts:
Apps in these locations are not affected by releases:
- Page (
LOCATION_PAGE) - Home (
LOCATION_HOME) - App Configuration (
LOCATION_APP_CONFIG)
Dialog Context Inheritance
When a dialog is opened from a release-aware location (Entry Field, Entry Sidebar, or Entry Editor), it inherits the parent’s release context. This means:
sdk.releasewill be defined in the dialog app- Entity selector dialogs (
selectSingleEntry,selectMultipleEntries, etc.) will show release-scoped entities - The dialog app should implement the same release-aware patterns as other entry-related apps
However, if the same dialog is opened from a non-release location (Page, Home, App Configuration), it will not have release context.
Unsupported Features in Release Context
The following SDK methods and features are not available when working with release-scoped entries:
Entry methods
sdk.entry.publish()- Throws error: “Publish entry method is not supported in release context”sdk.entry.unpublish()- Throws error: “Unpublish entry method is not supported in release context”