Fixes for getNextRequest in UI

This commit is contained in:
Brian Dentino 2023-10-20 12:36:05 -04:00 committed by mj-h
parent 4a1d45f458
commit d76253ea04
3 changed files with 7 additions and 7 deletions

View File

@ -1303,29 +1303,29 @@ export const collectionsSlice = createSlice({
} }
if (type === 'request-sent') { if (type === 'request-sent') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'queued');
item.status = 'running'; item.status = 'running';
item.requestSent = action.payload.requestSent; item.requestSent = action.payload.requestSent;
} }
if (type === 'response-received') { if (type === 'response-received') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running');
item.status = 'completed'; item.status = 'completed';
item.responseReceived = action.payload.responseReceived; item.responseReceived = action.payload.responseReceived;
} }
if (type === 'test-results') { if (type === 'test-results') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running');
item.testResults = action.payload.testResults; item.testResults = action.payload.testResults;
} }
if (type === 'assertion-results') { if (type === 'assertion-results') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running');
item.assertionResults = action.payload.assertionResults; item.assertionResults = action.payload.assertionResults;
} }
if (type === 'error') { if (type === 'error') {
const item = collection.runnerResult.items.find((i) => i.uid === request.uid); const item = collection.runnerResult.items.find((i) => i.uid === request.uid && i.status === 'running');
item.error = action.payload.error; item.error = action.payload.error;
item.responseReceived = action.payload.responseReceived; item.responseReceived = action.payload.responseReceived;
item.status = 'error'; item.status = 'error';

View File

@ -373,7 +373,7 @@ const handler = async function (argv) {
const nextRequestName = result?.nextRequestName; const nextRequestName = result?.nextRequestName;
if (nextRequestName) { if (nextRequestName) {
const nextRequestIdx = bruJsons.findIndex((iter) => iter.bruJson.name === nextRequestName); const nextRequestIdx = bruJsons.findIndex((iter) => iter.bruJson.name === nextRequestName);
if (nextRequestIdx > 0) { if (nextRequestIdx >= 0) {
currentRequestIndex = nextRequestIdx; currentRequestIndex = nextRequestIdx;
} else { } else {
console.error("Could not find request with name '" + nextRequestName + "'"); console.error("Could not find request with name '" + nextRequestName + "'");

View File

@ -866,7 +866,7 @@ const registerNetworkIpc = (mainWindow) => {
} }
if (nextRequestName) { if (nextRequestName) {
const nextRequestIdx = folderRequests.findIndex((request) => request.name === nextRequestName); const nextRequestIdx = folderRequests.findIndex((request) => request.name === nextRequestName);
if (nextRequestIdx > 0) { if (nextRequestIdx >= 0) {
currentRequestIndex = nextRequestIdx; currentRequestIndex = nextRequestIdx;
} else { } else {
console.error("Could not find request with name '" + nextRequestName + "'"); console.error("Could not find request with name '" + nextRequestName + "'");