Skip to content

Commit

Permalink
feat: open RunModal when no initial inputs and no test inputs are ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
srijanpatel committed Feb 18, 2025
1 parent 31b6b73 commit 748dbe2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/src/hooks/usePartialRun.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { updateNodeDataOnly, updateNodesFromPartialRun } from '@/store/flowSlice'
import { setRunModalOpen, updateNodeDataOnly, updateNodesFromPartialRun } from '@/store/flowSlice'
import { AppDispatch, RootState } from '@/store/store'
import { useState } from 'react'
import { useSelector } from 'react-redux'
Expand Down Expand Up @@ -44,7 +44,7 @@ const usePartialRun = (dispatch: AppDispatch) => {
try {
// If no initialInputs provided, use the selected test input
let effectiveInitialInputs = initialInputs
if (!effectiveInitialInputs) {
if (!effectiveInitialInputs && testInputs.length > 0) {
const testCase = testInputs.find((row) => row.id.toString() === selectedTestInputId) ?? testInputs[0]
if (testCase) {
const { id, ...inputValues } = testCase
Expand All @@ -57,6 +57,12 @@ const usePartialRun = (dispatch: AppDispatch) => {
}
}

// If no effectiveInitialInputs and no test inputs, open the RunModal
if (!effectiveInitialInputs && testInputs.length === 0) {
dispatch(setRunModalOpen(true))
return
}

const data = await runPartialWorkflow(
workflowId,
nodeId,
Expand Down

0 comments on commit 748dbe2

Please sign in to comment.