Forráskód Böngészése

Redirect right after a message is sent (#831)

Alexander Krivonosov 3 éve
szülő
commit
de33c13dc8

+ 1 - 7
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<Props> = ({
   sendTopicMessage,
   messageSchema,
   schemaIsFetched,
-  messageIsSent,
   messageIsSending,
   partitions,
 }) => {
@@ -81,11 +79,6 @@ const SendMessage: React.FC<Props> = ({
       }
     }
   }, [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<Props> = ({
           headers,
           partition,
         });
+        history.push(clusterTopicMessagesPath(clusterName, topicName));
       }
     }
   };

+ 0 - 2
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),
 });

+ 0 - 1
kafka-ui-react-app/src/components/Topics/Topic/SendMessage/__test__/SendMessage.spec.tsx

@@ -72,7 +72,6 @@ const setupWrapper = (props?: Partial<Props>) => (
       },
     }}
     schemaIsFetched={false}
-    messageIsSent={false}
     messageIsSending={false}
     partitions={[
       {

+ 0 - 5
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'