decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.83k stars 3.04k forks source link

Fatal error: "editorial_workflow is not defined" #7169

Closed jenlampton closed 5 months ago

jenlampton commented 5 months ago

I am running Netlify CMS with React.js, and when I add publish_mode: editorial_workflow, to my config.ts file, I then get a fatal error at http://localhost:3000/admin#/ that states "editorial_workflow is not defined".

My first guess is that Netlify CMS doesn't support editorial_workflow as a valid option for publish_mode (whereas Decap CMS does), but I have found a few posts in the Netlify forum indicating otherwise:

All these people are using either a config.yml or config.toml and nobody else seems to be using a config.ts file. Does that mean this feature isn't supported with React?

Describe the bug When I add publish_mode: editorial_workflow, to my config.ts file, I then get a fatal error at http://localhost:3000/admin#/ that states "editorial_workflow is not defined".

To Reproduce Steps to reproduce the behavior. For example:

  1. Get Netlify CMS running with React
  2. Log in to the CMS at http://localhost:3000/admin#/
  3. Edit the config.ts file, add publish_mode: editorial_workflow,
  4. Reload the page at http://localhost:3000/admin#/
  5. See error

Expected behavior editorial_workflow is enabled.

Screenshots

Screenshot 2024-04-09 at 5 36 38 PM

Applicable Versions:

CMS configuration

This is the complete config.ts file.

import { CollectionMenus } from './collections/CollectionMenus';
import { CollectionCategory } from './collections/CollectionCategory';
import { CollectionIndicator } from './collections/CollectionIndicator';
import { CollectionMorePages } from './collections/CollectionMorePages';
import { CollectionCharts } from './collections/CollectionCharts';
import { CollectionMaps } from './collections/CollectionMaps';
import { CollectionTargets } from './collections/CollectionTargets';
import { CollectionConfig } from './collections/CollectionConfig';

export const getConfig = () => {
  const config = {
    editor: {
      preview: true,
    },
    cms_manual_init: true,
    publish_mode: editorial_workflow,
    backend: {
      name: 'git-gateway', // git-gateway | test-repo
      branch: process.env.NEXT_PUBLIC_CMS_BRANCH,
      squash_merges: true,
    },
    load_config_file: false,
    media_folder: 'public/uploads/',
    public_folder: '/uploads',
    collections: [
      CollectionMenus,
      CollectionCategory,
      CollectionIndicator,
      CollectionMorePages,
      CollectionCharts,
      CollectionTargets,
      CollectionMaps,
      CollectionConfig,
    ],
  };

  const isLocalBackend = process.env.NEXT_PUBLIC_LOCAL_BACKEND === 'TRUE';

  if (isLocalBackend) {
    Object.assign(config, {
      local_backend: {
        url: 'http://localhost:8081/api/v1',
        allowed_hosts: ['192.168.0.1'],
      },
    });
  }

  return config;
};

Additional context

martinjagodic commented 5 months ago

@jenlampton can you try with the latest version of Decap please?

jenlampton commented 5 months ago

Okay, finally got updated to the latest version of Decap, and editorial workflow seems to be working for me. Thanks for the nudge, that was long overdue. Closing, and sorry for the noise.