🚸 (editor) Enable groups clipboard accross tabs
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { createWithEqualityFn } from 'zustand/traditional'
|
import { createWithEqualityFn } from 'zustand/traditional'
|
||||||
import { Coordinates, CoordinatesMap } from '../types'
|
import { Coordinates, CoordinatesMap } from '../types'
|
||||||
import { Edge, Group, GroupV6 } from '@typebot.io/schemas'
|
import { Edge, Group, GroupV6 } from '@typebot.io/schemas'
|
||||||
|
import { persist } from 'zustand/middleware'
|
||||||
|
|
||||||
type Store = {
|
type Store = {
|
||||||
focusedGroups: string[]
|
focusedGroups: string[]
|
||||||
@@ -19,7 +20,9 @@ type Store = {
|
|||||||
setIsDraggingGraph: (isDragging: boolean) => void
|
setIsDraggingGraph: (isDragging: boolean) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useGroupsStore = createWithEqualityFn<Store>((set, get) => ({
|
export const useGroupsStore = createWithEqualityFn<Store>()(
|
||||||
|
persist(
|
||||||
|
(set, get) => ({
|
||||||
focusedGroups: [],
|
focusedGroups: [],
|
||||||
groupsCoordinates: undefined,
|
groupsCoordinates: undefined,
|
||||||
groupsInClipboard: undefined,
|
groupsInClipboard: undefined,
|
||||||
@@ -84,4 +87,10 @@ export const useGroupsStore = createWithEqualityFn<Store>((set, get) => ({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
setIsDraggingGraph: (isDragging) => set({ isDraggingGraph: isDragging }),
|
setIsDraggingGraph: (isDragging) => set({ isDraggingGraph: isDragging }),
|
||||||
}))
|
}),
|
||||||
|
{
|
||||||
|
name: 'store',
|
||||||
|
partialize: (state) => ({ groupsInClipboard: state.groupsInClipboard }),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user