From de33c13dc856d958d29a344e86ca310894525413 Mon Sep 17 00:00:00 2001 From: Alexander Krivonosov <31561808+GneyHabub@users.noreply.github.com> Date: Mon, 30 Aug 2021 12:50:42 +0300 Subject: [PATCH] Redirect right after a message is sent (#831) --- .../components/Topics/Topic/SendMessage/SendMessage.tsx | 8 +------- .../Topics/Topic/SendMessage/SendMessageContainer.ts | 2 -- .../Topic/SendMessage/__test__/SendMessage.spec.tsx | 1 - kafka-ui-react-app/src/redux/reducers/topics/selectors.ts | 5 ----- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx index 4f813fe596..daaf0a7c09 100644 --- a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx +++ b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessage.tsx @@ -25,7 +25,6 @@ export interface Props { ) => void; messageSchema: TopicMessageSchema | undefined; schemaIsFetched: boolean; - messageIsSent: boolean; messageIsSending: boolean; partitions: Partition[]; } @@ -37,7 +36,6 @@ const SendMessage: React.FC = ({ sendTopicMessage, messageSchema, schemaIsFetched, - messageIsSent, messageIsSending, partitions, }) => { @@ -81,11 +79,6 @@ const SendMessage: React.FC = ({ } } }, [schemaIsFetched]); - React.useEffect(() => { - if (messageIsSent) { - history.push(clusterTopicMessagesPath(clusterName, topicName)); - } - }, [messageIsSent]); const onSubmit = async (data: { key: string; @@ -112,6 +105,7 @@ const SendMessage: React.FC = ({ headers, partition, }); + history.push(clusterTopicMessagesPath(clusterName, topicName)); } } }; diff --git a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessageContainer.ts b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessageContainer.ts index 80202e491f..8c9da7e679 100644 --- a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessageContainer.ts +++ b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/SendMessageContainer.ts @@ -7,7 +7,6 @@ import { getPartitionsByTopicName, getTopicMessageSchemaFetched, getTopicMessageSending, - getTopicMessageSent, } from 'redux/reducers/topics/selectors'; import SendMessage from './SendMessage'; @@ -31,7 +30,6 @@ const mapStateToProps = ( topicName, messageSchema: getMessageSchemaByTopicName(state, topicName), schemaIsFetched: getTopicMessageSchemaFetched(state), - messageIsSent: getTopicMessageSent(state), messageIsSending: getTopicMessageSending(state), partitions: getPartitionsByTopicName(state, topicName), }); diff --git a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/__test__/SendMessage.spec.tsx b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/__test__/SendMessage.spec.tsx index a05b69f1dc..919f6522d6 100644 --- a/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/__test__/SendMessage.spec.tsx +++ b/kafka-ui-react-app/src/components/Topics/Topic/SendMessage/__test__/SendMessage.spec.tsx @@ -72,7 +72,6 @@ const setupWrapper = (props?: Partial) => ( }, }} schemaIsFetched={false} - messageIsSent={false} messageIsSending={false} partitions={[ { diff --git a/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts b/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts index e454bf0f9b..fe0f5eaf5c 100644 --- a/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts +++ b/kafka-ui-react-app/src/redux/reducers/topics/selectors.ts @@ -72,11 +72,6 @@ export const getTopicMessageSchemaFetched = createSelector( (status) => status === 'fetched' ); -export const getTopicMessageSent = createSelector( - getTopicMessageSendingStatus, - (status) => status === 'fetched' -); - export const getTopicMessageSending = createSelector( getTopicMessageSendingStatus, (status) => status === 'fetching'