From 472ea89282eb9d71500df943868d779cd5aebbba Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Sun, 16 Feb 2025 16:22:25 -0800 Subject: [PATCH] fix(bug): memory block bug --- blocks/blocks/memory.ts | 54 +++++++++++++++++++---------------------- stores/index.ts | 6 +++-- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/blocks/blocks/memory.ts b/blocks/blocks/memory.ts index 6e6618ca4c..a4d3e2159f 100644 --- a/blocks/blocks/memory.ts +++ b/blocks/blocks/memory.ts @@ -3,37 +3,33 @@ import { BlockConfig } from '../types' export const MemoryBlock: BlockConfig = { type: 'memory', - toolbar: { - title: 'Memory', - description: 'Add memory store', - bgColor: '#FF65BF', - icon: BrainIcon, - category: 'blocks', - }, + name: 'Memory', + description: 'Add memory store', + bgColor: '#FF65BF', + icon: BrainIcon, + category: 'blocks', tools: { access: [], }, - workflow: { - inputs: { - code: { type: 'string', required: true }, - timeout: { type: 'number', required: false }, - memoryLimit: { type: 'number', required: false }, - }, - outputs: { - response: { - type: { - result: 'any', - stdout: 'string', - executionTime: 'number', - }, - }, - }, - subBlocks: [ - { - id: 'code', - type: 'code', - layout: 'full', - }, - ], + inputs: { + code: { type: 'string', required: true }, + timeout: { type: 'number', required: false }, + memoryLimit: { type: 'number', required: false }, }, + outputs: { + response: { + type: { + result: 'any', + stdout: 'string', + executionTime: 'number', + }, + }, + }, + subBlocks: [ + { + id: 'code', + type: 'code', + layout: 'full', + }, + ], } diff --git a/stores/index.ts b/stores/index.ts index 21b61dcb34..7633e093a1 100644 --- a/stores/index.ts +++ b/stores/index.ts @@ -10,9 +10,11 @@ import { useWorkflowStore } from './workflow/store' * Reset all application stores to their initial state */ export const resetAllStores = () => { - // Clear localStorage first + // Selectively clear localStorage items if (typeof window !== 'undefined') { - localStorage.clear() + const keysToKeep = ['next-favicon'] + const keysToRemove = Object.keys(localStorage).filter((key) => !keysToKeep.includes(key)) + keysToRemove.forEach((key) => localStorage.removeItem(key)) } // Force immediate state reset for all stores