Fixed an issue where the drag and drop table in ERD throws an error. Fixes #7333

This commit is contained in:
Aditya Toshniwal 2022-04-26 16:25:42 +05:30 committed by Akshay Joshi
parent 4f9eaf850d
commit 3d1a9624c1
3 changed files with 6 additions and 5 deletions

View File

@ -41,3 +41,4 @@ Bug fixes
| `Issue #7307 <https://redmine.postgresql.org/issues/7307>`_ - Fixed an issue where the table showed duplicate columns when creating multiple sequences on the same column.
| `Issue #7308 <https://redmine.postgresql.org/issues/7308>`_ - Ensure that sorting should be preserved on refresh for Server Activity.
| `Issue #7322 <https://redmine.postgresql.org/issues/7322>`_ - Fixed an issue while creating a new database throwing an error that failed to retrieve data.
| `Issue #7333 <https://redmine.postgresql.org/issues/7333>`_ - Fixed an issue where the drag and drop table in ERD throws an error.

View File

@ -209,7 +209,7 @@ export class TableNodeWidget extends React.Component {
}
render() {
let tableData = this.props.node.getData();
let tableData = this.props.node.getData() || {};
let tableMetaData = this.props.node.getMetadata();
let localFkCols = [];
(tableData.foreign_key||[]).forEach((fk)=>{

View File

@ -96,7 +96,7 @@ export default class BodyWidget extends React.Component {
_.bindAll(this, ['onLoadDiagram', 'onSaveDiagram', 'onSaveAsDiagram', 'onSQLClick',
'onImageClick', 'onAddNewNode', 'onEditTable', 'onCloneNode', 'onDeleteNode', 'onNoteClick',
'onNoteClose', 'onOneToManyClick', 'onManyToManyClick', 'onAutoDistribute', 'onDetailsToggle',
'onDetailsToggle', 'onHelpClick', 'onDropNode',
'onDetailsToggle', 'onHelpClick', 'onDropNode', 'onBeforeUnload',
]);
this.diagram.zoomToFit = this.diagram.zoomToFit.bind(this.diagram);
@ -223,6 +223,7 @@ export default class BodyWidget extends React.Component {
});
this.props.panel?.on(window.wcDocker?.EVENT.CLOSING, () => {
window.removeEventListener('beforeunload', this.onBeforeUnload);
if(this.state.dirty) {
this.closeOnSave = false;
this.confirmBeforeClose();
@ -241,11 +242,11 @@ export default class BodyWidget extends React.Component {
await this.loadTablesData();
}
window.addEventListener('beforeunload', this.onBeforeUnload.bind(this));
window.addEventListener('beforeunload', this.onBeforeUnload);
}
componentWillUnmount() {
window.removeEventListener('beforeunload', this.onBeforeUnload.bind(this));
window.removeEventListener('beforeunload', this.onBeforeUnload);
}
componentDidUpdate() {
@ -306,7 +307,6 @@ export default class BodyWidget extends React.Component {
}
closePanel() {
window.onbeforeunload = null;
this.props.panel.off(window.wcDocker.EVENT.CLOSING);
this.props.pgWindow.pgAdmin.Browser.docker.removePanel(this.props.panel);
}