2
0

🚸 (editor) Enable groups clipboard accross tabs

This commit is contained in:
Baptiste Arnaud
2024-02-12 09:10:04 +01:00
parent a0ab3b4d82
commit e05580a5de

View File

@ -1,6 +1,7 @@
import { createWithEqualityFn } from 'zustand/traditional'
import { Coordinates, CoordinatesMap } from '../types'
import { Edge, Group, GroupV6 } from '@typebot.io/schemas'
import { persist } from 'zustand/middleware'
type Store = {
focusedGroups: string[]
@ -19,7 +20,9 @@ type Store = {
setIsDraggingGraph: (isDragging: boolean) => void
}
export const useGroupsStore = createWithEqualityFn<Store>((set, get) => ({
export const useGroupsStore = createWithEqualityFn<Store>()(
persist(
(set, get) => ({
focusedGroups: [],
groupsCoordinates: undefined,
groupsInClipboard: undefined,
@ -84,4 +87,10 @@ export const useGroupsStore = createWithEqualityFn<Store>((set, get) => ({
},
}),
setIsDraggingGraph: (isDragging) => set({ isDraggingGraph: isDragging }),
}))
}),
{
name: 'store',
partialize: (state) => ({ groupsInClipboard: state.groupsInClipboard }),
}
)
)