More fixes related to rc-dock changes. #6479

This commit is contained in:
Aditya Toshniwal 2023-11-20 17:45:17 +05:30
parent d8bcc11a95
commit 19cbe8c39f
3 changed files with 24 additions and 24 deletions

View File

@ -79,7 +79,7 @@ function SQL({nodeData, node, treeNodeInfo, isActive, isStale, setIsStale}) {
gettext(e.response.data.errormsg)
);
// show failed message.
setNodeSQL([gettext('Failed to retrieve data from the server.'), true]);
setNodeSQL(gettext('Failed to retrieve data from the server.'));
setLoaderText('');
}).then(()=>{
setLoaderText('');

View File

@ -33,9 +33,7 @@ function TabTitle({id, closable, defaultInternal}) {
}, []);
useEffect(()=>{
let deregister;
if(internal.renamable) {
deregister = layoutDocker.eventBus.registerListener(LAYOUT_EVENTS.REFRESH_TITLE, _.debounce((panelId)=>{
const deregister = layoutDocker.eventBus.registerListener(LAYOUT_EVENTS.REFRESH_TITLE, _.debounce((panelId)=>{
if(panelId == id) {
const internal = layoutDocker?.find(id)?.internal??{};
setAttrs({
@ -45,7 +43,6 @@ function TabTitle({id, closable, defaultInternal}) {
});
}
}, 100));
}
return ()=>deregister?.();
}, []);

View File

@ -11,6 +11,7 @@ import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { LayoutDockerContext, LAYOUT_EVENTS } from './Layout';
import { usePgAdmin } from '../../../static/js/BrowserComponent';
import ErrorBoundary from './ErrorBoundary';
export default function withStandardTabInfo(Component, tabId) {
// eslint-disable-next-line react/display-name
@ -63,6 +64,7 @@ export default function withStandardTabInfo(Component, tabId) {
}, []);
return (
<ErrorBoundary>
<Component
{...props}
nodeItem={nodeItem}
@ -73,6 +75,7 @@ export default function withStandardTabInfo(Component, tabId) {
isStale={isStale}
setIsStale={(v)=>setNodeInfo((prev)=>[v, prev[1], prev[2]])}
/>
</ErrorBoundary>
);
};