fix(ui/connections): fixed tag dropdown and connection block not accurately reflecting source block response format by changing reference from workflow/subblock response format to dedicated subblock store

This commit is contained in:
Waleed Latif
2025-02-23 00:46:02 -08:00
parent 48a895217e
commit 99a645cfad
2 changed files with 14 additions and 3 deletions
+7 -1
View File
@@ -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 {
+7 -2
View File
@@ -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<TagDropdownProps> = ({
// 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<TagDropdownProps> = ({
// 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) {