From ee2295aec105fab734472fac551d94fff119b1a6 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Fri, 15 Dec 2023 00:55:21 +0530 Subject: [PATCH] pr #1184: addressed review comments --- .../components/ResponsePane/ResponseClear/index.js | 7 +++---- .../providers/ReduxStore/slices/collections/index.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js b/packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js index 7c2d6bbcf..747543347 100644 --- a/packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js +++ b/packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js @@ -2,15 +2,14 @@ import React from 'react'; import { IconEraser } from '@tabler/icons'; import { useDispatch } from 'react-redux'; import StyledWrapper from './StyledWrapper'; -import { responseReceived } from 'providers/ReduxStore/slices/collections/index'; +import { responseCleared } from 'providers/ReduxStore/slices/collections/index'; const ResponseClear = ({ collection, item }) => { const dispatch = useDispatch(); - const response = item.response || {}; const clearResponse = () => dispatch( - responseReceived({ + responseCleared({ itemUid: item.uid, collectionUid: collection.uid, response: null @@ -19,7 +18,7 @@ const ResponseClear = ({ collection, item }) => { return ( - diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js index 46c727f4f..f464e5130 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js @@ -269,6 +269,16 @@ export const collectionsSlice = createSlice({ } } }, + responseCleared: (state, action) => { + const collection = findCollectionByUid(state.collections, action.payload.collectionUid); + + if (collection) { + const item = findItemInCollection(collection, action.payload.itemUid); + if (item) { + item.response = null; + } + } + }, saveRequest: (state, action) => { const collection = findCollectionByUid(state.collections, action.payload.collectionUid); @@ -1397,6 +1407,7 @@ export const { processEnvUpdateEvent, requestCancelled, responseReceived, + responseCleared, saveRequest, deleteRequestDraft, newEphemeralHttpRequest,