Skip to content

Documentation

schedule-modal Component

Documentation for the scheduling modal that allows future-dated publish/unpublish/delete actions.

6/27/2026
2 min read Edit on GitHub

The schedule-modal component provides a user interface for scheduling future actions (publish, unpublish, delete) on collection entries.


Architecture

flowchart LR subgraph Trigger["Action Trigger"] MB[MultiButton] EA[EntryActions] end subgraph Modal["schedule-modal"] DI[Date Input] TI[Time Input] AS[Action Select] VL[Validation] end subgraph Response["Response Handler"] MS[modalState] CB[Callback] end Trigger -->|Open| Modal DI --> VL TI --> VL VL -->|Valid| CB CB --> MS MS -->|Close| Trigger

Features

Feature Description
DateTime Selection Separate date and time inputs for precision
Action Selection Choose between publish, unpublish, or delete
Future Validation Enforces scheduling for future dates only
Modal Integration Uses modalState for dialog management
Accessible ARIA labels and keyboard navigation

User Flow

sequenceDiagram
    participant U as User
    participant MB as MultiButton
    participant SM as schedule-modal
    participant MS as modalState
    participant API as Server

    U->>MB: Click Schedule
    MB->>MS: Open modal
    MS->>SM: Render form
    U->>SM: Select date/time/action
    SM->>SM: Validate (future date)
    U->>SM: Click Schedule
    SM->>MS: close(response)
    MS->>MB: Callback with data
    MB->>API: Schedule action

Draft Relation Validation

When scheduling a publish action, the background scheduler (see scheduled-jobs.ts) now validates that all relation fields on the entry reference only published content. If any referenced entry is still in draft status, the publish is skipped and a warning is logged.

flowchart LR SP[Schedule Publish] --> RV[Validate Relations] RV -->|All published| P[Publish Entry] RV -->|Has draft refs| S[Skip + Log Warning] P --> CI[Cache Invalidation]

This prevents broken front-end experiences where an entry is published but references content not yet visible to visitors.

Cache invalidation: After a successful scheduled publish, the collection’s cache is automatically invalidated to prevent stale relation data from being served.


Response Format

interface ScheduleResponse {
  confirmed: boolean;
  date: Date;
  action: "publish" | "unpublish" | "delete";
}

Usage

The modal is opened via modalState and returns a response object:

// Opening the modal
modalState.open({
  component: schedule - modal,
  props: {
    meta: { initialAction: "publish" },
  },
});

// Handling response (via modalState callback)
// { confirmed: true, date: Date, action: 'publish' }

Related Documentation

componentsschedulingmodalpublish
Was this page helpful?