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