From 9adecebbf2827f9e2ee4796e21638279c8eebee0 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Mon, 17 Jun 2024 14:23:57 -0700 Subject: [PATCH] remove unnecessary useCallback in Widgets component --- frontend/app/workspace/workspace.tsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/app/workspace/workspace.tsx b/frontend/app/workspace/workspace.tsx index 27b1a6f2..80a35342 100644 --- a/frontend/app/workspace/workspace.tsx +++ b/frontend/app/workspace/workspace.tsx @@ -15,7 +15,7 @@ import { getLayoutStateAtomForTab, useLayoutTreeStateReducerAtom, } from "@/faraday/lib/layoutAtom"; -import { useCallback, useMemo } from "react"; +import { useMemo } from "react"; import "./workspace.less"; function Tab({ tabId }: { tabId: string }) { @@ -71,16 +71,13 @@ function Widgets() { }, [windowData.activetabid]); const [, dispatchLayoutStateAction] = useLayoutTreeStateReducerAtom(activeTabAtom); - const addBlockToTab = useCallback( - (blockId: string) => { - const insertNodeAction: LayoutTreeInsertNodeAction = { - type: LayoutTreeActionType.InsertNode, - node: newLayoutNode(undefined, undefined, undefined, { blockId }), - }; - dispatchLayoutStateAction(insertNodeAction); - }, - [activeTabAtom, dispatchLayoutStateAction] - ); + function addBlockToTab(blockId: string) { + const insertNodeAction: LayoutTreeInsertNodeAction = { + type: LayoutTreeActionType.InsertNode, + node: newLayoutNode(undefined, undefined, undefined, { blockId }), + }; + dispatchLayoutStateAction(insertNodeAction); + } async function createBlock(blockDef: BlockDef) { const rtOpts: RuntimeOpts = { termsize: { rows: 25, cols: 80 } };