LibrayPanels: Fix unlinking libray panel (#57825)

This commit is contained in:
Torkel Ödegaard 2022-11-02 11:38:48 +01:00 committed by GitHub
parent 30dc0f56a4
commit d7f9093ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -370,8 +370,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
onClick={() => {
showModal(UnlinkModal, {
onConfirm: () => {
delete this.props.panel.libraryPanel;
this.props.panel.render();
this.props.panel.unlinkLibraryPanel();
this.forceUpdate();
},
onDismiss: hideModal,

View File

@ -672,6 +672,12 @@ export class PanelModel implements DataConfigSource, IPanelModel {
}
this.libraryPanel = libPanel;
}
unlinkLibraryPanel() {
delete this.libraryPanel;
this.configRev++;
this.render();
}
}
function getPluginVersion(plugin: PanelPlugin): string {

View File

@ -87,10 +87,7 @@ export const unlinkLibraryPanel = (panel: PanelModel) => {
new ShowModalReactEvent({
component: UnlinkModal,
props: {
onConfirm: () => {
delete panel.libraryPanel;
panel.render();
},
onConfirm: () => panel.unlinkLibraryPanel(),
isOpen: true,
},
})