Repository: provectus/kafka-ui
Issue: Schema type is not updated when history push
Labels: type/bug
scope/frontend
status/accepted
status/confirmed

**Describe the bug**
(A clear and concise description of what the bug is.)
There's a problem while page history changes after update schema type. A new value appears to late and the one is rendered


**Set up**
(How do you run the app? 
Which version of the app are you running? Provide either docker image version or check commit hash at the top left corner. We won't be able to help you without this information.)


**Steps to Reproduce**
Steps to reproduce the behavior:

1. Click schema edit, change its type, submit.

**Expected behavior**
(A clear and concise description of what you expected to happen)
A new schema type should appear. Hovewer in response it is new, but on page its not. The same behaviour is with reset offsets

**Screenshots**
(If applicable, add screenshots to help explain your problem)


**Additional context**
(Add any other context about the problem here)


Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/components/ConsumerGroups/Details/ResetOffsets/ResetOffsets.tsx b/kafka-ui-react-app/src/components/ConsumerGroups/Details/ResetOffsets/ResetOffsets.tsx
index ce574325f69..66377f8bce0 100644
--- a/kafka-ui-react-app/src/components/ConsumerGroups/Details/ResetOffsets/ResetOffsets.tsx
+++ b/kafka-ui-react-app/src/components/ConsumerGroups/Details/ResetOffsets/ResetOffsets.tsx
@@ -194,6 +194,7 @@ const ResetOffsets: React.FC = () => {
                     minWidth="100%"
                     name={name}
                     onChange={onChange}
+                    defaultValue={value}
                     value={value}
                     options={uniqueTopics.map((topic) => ({
                       value: topic,
diff --git a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
index 59a0b75ba8a..0507652be45 100644
--- a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
+++ b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
@@ -14,7 +14,9 @@ import { InputLabel } from 'components/common/Input/InputLabel.styled';
 import PageHeading from 'components/common/PageHeading/PageHeading';
 import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
 import {
+  schemaAdded,
   schemasApiClient,
+  schemaUpdated,
   selectSchemaById,
 } from 'redux/reducers/schemas/schemasSlice';
 import { serverErrorAlertAdded } from 'redux/reducers/alerts/alertsSlice';
@@ -48,7 +50,7 @@ const Edit: React.FC = () => {
 
     try {
       if (dirtyFields.newSchema || dirtyFields.schemaType) {
-        await schemasApiClient.createNewSchema({
+        const resp = await schemasApiClient.createNewSchema({
           clusterName,
           newSchemaSubject: {
             ...schema,
@@ -56,6 +58,7 @@ const Edit: React.FC = () => {
             schemaType: props.schemaType || schema.schemaType,
           },
         });
+        dispatch(schemaAdded(resp));
       }
 
       if (dirtyFields.compatibilityLevel) {
@@ -66,6 +69,12 @@ const Edit: React.FC = () => {
             compatibility: props.compatibilityLevel,
           },
         });
+        dispatch(
+          schemaUpdated({
+            ...schema,
+            compatibilityLevel: props.compatibilityLevel,
+          })
+        );
       }
 
       history.push(clusterSchemaPath(clusterName, subject));
diff --git a/kafka-ui-react-app/src/redux/reducers/schemas/schemasSlice.ts b/kafka-ui-react-app/src/redux/reducers/schemas/schemasSlice.ts
index 69b38ed0128..cfc358815f3 100644
--- a/kafka-ui-react-app/src/redux/reducers/schemas/schemasSlice.ts
+++ b/kafka-ui-react-app/src/redux/reducers/schemas/schemasSlice.ts
@@ -55,6 +55,7 @@ const schemasSlice = createSlice({
   }),
   reducers: {
     schemaAdded: schemasAdapter.addOne,
+    schemaUpdated: schemasAdapter.upsertOne,
   },
   extraReducers: (builder) => {
     builder.addCase(fetchSchemas.fulfilled, (state, { payload }) => {
@@ -74,7 +75,7 @@ export const { selectAll: selectAllSchemaVersions } =
     (state) => state.schemas.versions
   );
 
-export const { schemaAdded } = schemasSlice.actions;
+export const { schemaAdded, schemaUpdated } = schemasSlice.actions;
 
 export const getAreSchemasFulfilled = createSelector(
   createFetchingSelector('schemas/fetch'),


Test patch: