fix: toggling AppDetailNav causes unnecessary component rerenders (#3718)

This commit is contained in:
legao 2024-04-24 04:07:28 +00:00 • committed by GitHub
commit 40e36e9b52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 314 additions and 276 deletions

View file

@ -1,8 +1,8 @@
import { useContext } from 'react'
import {
create,
useStore as useZustandStore,
} from 'zustand'
import { createStore } from 'zustand/vanilla'
import { debounce } from 'lodash-es'
import type { Viewport } from 'reactflow'
import type {
@ -70,9 +70,9 @@ type Shape = {
}
export const createWorkflowStore = () => {
return create<Shape>(set => ({
return createStore<Shape>(set => ({
appId: '',
workflowData: undefined,
workflowRunningData: undefined,
setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })),
historyWorkflowData: undefined,
setHistoryWorkflowData: historyWorkflowData => set(() => ({ historyWorkflowData })),