v1 to v2 Client-side Migration Guide
This guide describes how to migrate the client-side code of a workflow extension plugin from v1 to v2. The core change in the v2 client is replacing Formily Schema declarative configuration UIs with a Loader + pure React/antd component approach.
Overview
Main Changes
- Import path changes:
@nocobase/plugin-workflow/client→@nocobase/plugin-workflow/client-v2, plugin base class@nocobase/client→@nocobase/client-v2 - Configuration UI pattern changes: From Formily Schema objects (
fieldset) to Loader lazy-loaded React components (FieldsetLoader) scope/componentsproperties removed: No longer necessary to inject scope objects or components into the Schema; simply import and use them directly in React components
Import path mapping
General Rules
Loader pattern
v2 uses LoaderOf-typed properties to replace v1's fieldset and other Formily Schema objects. A Loader is essentially a function that returns Promise<{ default: ComponentType }>, enabling code splitting and lazy loading via dynamic import():
If you need to point to a named export (rather than the default export), use .then() to remap:
Configuration component syntax
The component loaded by a Loader is a standard React function component that uses antd's Form.Item to build forms. Field paths consistently use the nested array format ['config', 'fieldName']:
Trigger Migration
Property mapping table
Migration example
v1 syntax:
v2 syntax:
Plugin registration
Node Migration
Property mapping table
Migration example
v1 syntax:
v2 syntax:
Other Notes
Unchanged parts
The following properties and methods have essentially the same signatures in v1 and v2, and can be kept as-is during migration:
useVariables(node/config, options)— Provides variable optionsuseScopeVariables(node, options)— Provides branch-scoped variablesisAvailable(ctx)— Node availability check (the v2NodeAvailableContextadds a newengineproperty)
New properties in v2
getCreateModelMenuItem— Defines the configuration for creating sub-model menu items for nodes/triggers on the v2 canvasuseTempAssociationSource— Provides temporary association data source informationvalidate(config)— Trigger configuration validation (triggers only)branching— Declares whether the node is a branch node (nodes only)end— Declares whether the node is a terminal node (nodes only)testable— Declares whether the node supports test runs (nodes only)
Value semantic consistency
When migrating, make sure the form values produced by v2 components are consistent with v1, especially the payload shape during manual execution. For example, if the v1 manual execution form stores a complete record object, the v2 version must maintain the same value structure rather than storing only the primary key.

