fix: fixed codemirror performance issue

This commit is contained in:
Anoop M D 2022-03-16 04:01:42 +05:30
parent 762599b82e
commit 8b48a388ad

View File

@ -2,6 +2,7 @@ import React from 'react';
import RequestTabs from 'components/RequestTabs';
import RequestTabPanel from 'components/RequestTabPanel';
import Sidebar from 'components/Sidebar';
import { useStore } from 'providers/Store';
import StyledWrapper from './StyledWrapper';
const SERVER_RENDERED = typeof navigator === 'undefined' || global['PREVENT_CODEMIRROR_RENDER'] === true;
@ -29,6 +30,11 @@ if(!SERVER_RENDERED) {
export default function Main() {
const [store, storeDispatch] = useStore();
const {
activeRequestTabUid
} = store;
if (SERVER_RENDERED) {
return null;
}
@ -39,7 +45,7 @@ export default function Main() {
<Sidebar />
<section className='flex flex-grow flex-col'>
<RequestTabs />
<RequestTabPanel />
<RequestTabPanel key={activeRequestTabUid}/>
</section>
</StyledWrapper>
</div>