From 48ae45dbb0957c07662b0ac73912136c9e2d2edd Mon Sep 17 00:00:00 2001 From: Pavel Angelov Date: Thu, 24 Apr 2025 15:21:02 +0300 Subject: [PATCH 1/2] reset editor to default every time a json is open --- redisinsight/ui/src/slices/browser/rejson.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/redisinsight/ui/src/slices/browser/rejson.ts b/redisinsight/ui/src/slices/browser/rejson.ts index d3da10996a..f444e9b28a 100644 --- a/redisinsight/ui/src/slices/browser/rejson.ts +++ b/redisinsight/ui/src/slices/browser/rejson.ts @@ -189,6 +189,7 @@ export function fetchReJSON( dispatch(addErrorNotification(error)) } } + dispatch(setEditorType(EditorType.Default)) } } From ac6a607f4088886a55cd62ab9365591cefba8bbb Mon Sep 17 00:00:00 2001 From: Pavel Angelov Date: Thu, 24 Apr 2025 16:06:44 +0300 Subject: [PATCH 2/2] fix tests --- redisinsight/ui/src/slices/tests/browser/rejson.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redisinsight/ui/src/slices/tests/browser/rejson.spec.ts b/redisinsight/ui/src/slices/tests/browser/rejson.spec.ts index 0ff5610932..3f3b37568d 100644 --- a/redisinsight/ui/src/slices/tests/browser/rejson.spec.ts +++ b/redisinsight/ui/src/slices/tests/browser/rejson.spec.ts @@ -7,6 +7,7 @@ import { mockedStore, mockStore, } from 'uiSrc/utils/test-utils' +import { EditorType } from 'uiSrc/slices/interfaces' import successMessages from 'uiSrc/components/notifications/success-messages' import { GetRejsonRlResponseDto } from 'apiSrc/modules/browser/rejson-rl/dto' import reducer, { @@ -29,6 +30,7 @@ import reducer, { setReJSONDataAction, appendReJSONArrayItemAction, removeReJSONKeyAction, + setEditorType, } from '../../browser/rejson' import { addErrorNotification, @@ -405,6 +407,7 @@ describe('rejson slice', () => { const expectedActions = [ loadRejsonBranch(), loadRejsonBranchSuccess(responsePayload.data), + setEditorType(EditorType.Default), // and always set editor type to default ] expect(store.getActions()).toEqual(expectedActions) }) @@ -432,6 +435,7 @@ describe('rejson slice', () => { loadRejsonBranch(), loadRejsonBranchFailure(responsePayload.response.data.message), addErrorNotification(responsePayload as AxiosError), + setEditorType(EditorType.Default), // and always set editor type to default ] expect(store.getActions()).toEqual(expectedActions) })