mirror of
https://github.com/langgenius/dify.git
synced 2026-02-24 20:01:22 +08:00
Use nuqs to sync graph/skill view selection to URL, enabling shareable links and browser history navigation. Hoists SkillEditorProvider to maintain state across view switches.
12 lines
335 B
TypeScript
12 lines
335 B
TypeScript
import { parseAsStringEnum } from 'nuqs'
|
|
import { ViewType } from '@/app/components/workflow/types'
|
|
|
|
export const parseAsViewType = parseAsStringEnum<ViewType>(Object.values(ViewType))
|
|
.withDefault(ViewType.graph)
|
|
.withOptions({
|
|
history: 'replace',
|
|
clearOnDefault: true,
|
|
})
|
|
|
|
export const WORKFLOW_VIEW_PARAM_KEY = 'view'
|