Files
dify/web/app/components/workflow/skill/constants.ts
yyh 98d1aac765 feat(skill-editor): add persistent Start tab and optimize store subscriptions
- Add START_TAB_ID constant and StartTabItem/StartTabContent components
- Default to Start tab when no file tabs are open
- Optimize zustand selectors to subscribe to specific Map values instead of
  entire Map objects, reducing unnecessary re-renders when other tabs change
- Refactor useSkillFileSave to accept precise values instead of Map/Set
2026-01-23 13:12:22 +08:00

30 lines
907 B
TypeScript

/**
* File Tree Constants - Single source of truth for root/blank identifiers
*/
// Root folder identifier (convert to null for API calls via toApiParentId)
export const ROOT_ID = 'root' as const
// Start tab identifier - a special tab that is always present
export const START_TAB_ID = '__start__' as const
// Drag type identifier for internal tree node dragging
export const INTERNAL_NODE_DRAG_TYPE = 'application/x-dify-tree-node'
// Context menu trigger types (describes WHERE user clicked)
export const CONTEXT_MENU_TYPE = {
BLANK: 'blank',
NODE: 'node',
} as const
export type ContextMenuType = (typeof CONTEXT_MENU_TYPE)[keyof typeof CONTEXT_MENU_TYPE]
// Node menu types (determines which menu options to show)
export const NODE_MENU_TYPE = {
ROOT: 'root',
FOLDER: 'folder',
FILE: 'file',
} as const
export type NodeMenuType = (typeof NODE_MENU_TYPE)[keyof typeof NODE_MENU_TYPE]