mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
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:
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user