mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
refactor: migrate localStorage calls to storage utility module
Replace direct localStorage.getItem/setItem/removeItem with the centralized storage module which provides versioned keys, automatic JSON serialization, SSR safety, and error handling.
This commit is contained in:
@ -21,6 +21,7 @@ import {
|
||||
syncWorkflowDraft,
|
||||
} from '@/service/workflow'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import { storage } from '@/utils/storage'
|
||||
import { useWorkflowTemplate } from './use-workflow-template'
|
||||
|
||||
const hasConnectedUserInput = (nodes: Node[] = [], edges: Edge[] = []): boolean => {
|
||||
@ -87,9 +88,9 @@ export const useWorkflowInit = () => {
|
||||
const edgesData = isAdvancedChat ? edgesTemplate : []
|
||||
|
||||
const runtimeStorageKey = `${STORAGE_KEYS.LOCAL.WORKFLOW.SANDBOX_RUNTIME_PREFIX}${appDetail.id}`
|
||||
const enableSandboxRuntime = localStorage.getItem(runtimeStorageKey) === '1'
|
||||
const enableSandboxRuntime = storage.getBoolean(runtimeStorageKey) === true
|
||||
if (enableSandboxRuntime)
|
||||
localStorage.removeItem(runtimeStorageKey)
|
||||
storage.remove(runtimeStorageKey)
|
||||
|
||||
syncWorkflowDraft({
|
||||
url: `/apps/${appDetail.id}/workflows/draft`,
|
||||
|
||||
Reference in New Issue
Block a user