diff --git a/app/w/hooks/use-block-connections.ts b/app/w/hooks/use-block-connections.ts index 5f3bd3583b..419443bbeb 100644 --- a/app/w/hooks/use-block-connections.ts +++ b/app/w/hooks/use-block-connections.ts @@ -1,5 +1,6 @@ import { shallow } from 'zustand/shallow' import { useWorkflowStore } from '@/stores/workflow/store' +import { useSubBlockStore } from '@/stores/workflow/subblock/store' interface Field { name: string @@ -30,7 +31,12 @@ export function useBlockConnections(blockId: string) { .filter((edge) => edge.target === blockId) .map((edge) => { const sourceBlock = blocks[edge.source] - const responseFormatValue = sourceBlock.subBlocks?.responseFormat?.value + + // Get the response format from the subblock store instead + const responseFormatValue = useSubBlockStore + .getState() + .getValue(edge.source, 'responseFormat') + let responseFormat try { diff --git a/components/ui/tag-dropdown.tsx b/components/ui/tag-dropdown.tsx index 9b58e5445c..68b0273d2e 100644 --- a/components/ui/tag-dropdown.tsx +++ b/components/ui/tag-dropdown.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useMemo, useState } from 'react' import { cn } from '@/lib/utils' import { useWorkflowStore } from '@/stores/workflow/store' +import { useSubBlockStore } from '@/stores/workflow/subblock/store' interface Field { name: string @@ -95,7 +96,9 @@ export const TagDropdown: React.FC = ({ // Then check for response format try { - const responseFormatValue = sourceBlock.subBlocks?.responseFormat?.value + const responseFormatValue = useSubBlockStore + .getState() + .getValue(activeSourceBlockId, 'responseFormat') if (typeof responseFormatValue === 'string' && responseFormatValue) { const responseFormat = JSON.parse(responseFormatValue) if (responseFormat?.fields) { @@ -128,7 +131,9 @@ export const TagDropdown: React.FC = ({ // Check for response format first try { - const responseFormatValue = sourceBlock.subBlocks?.responseFormat?.value + const responseFormatValue = useSubBlockStore + .getState() + .getValue(edge.source, 'responseFormat') if (typeof responseFormatValue === 'string' && responseFormatValue) { const responseFormat = JSON.parse(responseFormatValue) if (responseFormat?.fields) {