Fixed block deletion bug

This commit is contained in:
Emir Karabeg
2025-01-21 20:38:40 -08:00
parent c61ac72b47
commit cc68272b48
3 changed files with 6 additions and 5 deletions
@@ -1,11 +1,11 @@
import { useBlockConnections } from '@/app/w/hooks/use-block-connections'
import { Card } from '@/components/ui/card'
interface ConnectionBlockProps {
interface ConnectionBlocksProps {
blockId: string
}
export function ConnectionBlock({ blockId }: ConnectionBlockProps) {
export function ConnectionBlocks({ blockId }: ConnectionBlocksProps) {
const { incomingConnections, hasIncomingConnections } =
useBlockConnections(blockId)
@@ -4,7 +4,7 @@ import { SubBlock } from './components/sub-block/sub-block'
import { Handle, Position } from 'reactflow'
import { cn } from '@/lib/utils'
import { ActionBar } from './components/action-bar/action-bar'
import { ConnectionBlock } from './components/connection-block/connection-block'
import { ConnectionBlocks } from './components/connection-blocks/connection-blocks'
interface WorkflowBlockProps {
id: string
@@ -53,7 +53,7 @@ export function WorkflowBlock({
return (
<Card className="w-[320px] shadow-md select-none group relative cursor-default">
{selected && <ActionBar blockId={id} />}
<ConnectionBlock blockId={id} />
<ConnectionBlocks blockId={id} />
<Handle
type="target"
+2 -1
View File
@@ -32,8 +32,9 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
updateSubBlock: (blockId: string, subBlockId: string, value: any) => {
set((state) => {
const block = state.blocks[blockId]
const blockConfig = getBlock(block.type)
if (!block) return state
const blockConfig = getBlock(block.type)
if (!blockConfig) return state
// Create new subBlocks state