@@ -9,13 +9,15 @@ import React, {
99import { useLocation } from 'react-router-dom'
1010import { Flow , PipeData , PipeMeta } from 'src/types/flows'
1111import { FlowListContext , FlowListProvider } from 'src/flows/context/flow.list'
12- import { v4 as UUID } from 'uuid '
12+ import { customAlphabet } from 'nanoid '
1313import { DEFAULT_PROJECT_NAME , PIPE_DEFINITIONS } from 'src/flows'
1414import { isFlagEnabled } from 'src/shared/utils/featureFlag'
15- import * as Y from 'yjs'
15+ import { Doc } from 'yjs'
1616import { WebsocketProvider } from 'y-websocket'
1717import { serialize , hydrate } from 'src/flows/context/flow.list'
1818
19+ const prettyid = customAlphabet ( 'abcdefghijklmnop0123456789' , 12 )
20+
1921export interface FlowContextType {
2022 name : string
2123 flow : Flow | null
@@ -46,7 +48,7 @@ export const FlowProvider: FC = ({children}) => {
4648 const { flows, update, currentID} = useContext ( FlowListContext )
4749 const [ currentFlow , setCurrentFlow ] = useState < Flow > ( )
4850 const provider = useRef < WebsocketProvider > ( )
49- const yDoc = useRef ( new Y . Doc ( ) )
51+ const yDoc = useRef ( new Doc ( ) )
5052 function disconnectProvider ( ) {
5153 if ( provider . current ) {
5254 provider . current . disconnect ( )
@@ -239,7 +241,7 @@ export const FlowProvider: FC = ({children}) => {
239241 )
240242
241243 const addPipe = ( initial : PipeData , index ?: number ) => {
242- const id = `local_ ${ UUID ( ) } `
244+ const id = prettyid ( )
243245 const title =
244246 initial . title ||
245247 `${ PIPE_DEFINITIONS [ initial . type ] . button || 'Panel' } ${ ++ GENERATOR_INDEX } `
0 commit comments