Annotations: Ensure legacy annotation editors are cleaned up properly when switching datasource (#41115)

* Annotations: Ensure Angular-based annotation editors are cleaned up properly

* Annotations: Remove ng-if instead of wrapping in div
This commit is contained in:
Ashley Harrison 2021-11-02 15:30:20 +00:00 committed by GitHub
parent 3c5003373c
commit e0b2e0b152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,10 @@ export class AngularEditorLoader extends React.PureComponent<Props> {
}
const loader = getAngularLoader();
const template = `<plugin-component ng-if="!ctrl.currentDatasource.annotations" type="annotations-query-ctrl"> </plugin-component>`;
// NOTE: BE CAREFUL HERE
// If this template contains an ng-if, then it won't be removed correctly by AngularLoader.
// The compiledElem will only contain the single comment node (e.g. <!-- ngIf !ctrl.currentDatasource.annotations -->)
const template = `<plugin-component type="annotations-query-ctrl"> </plugin-component>`;
const scopeProps = {
ctrl: {
currentDatasource: this.props.datasource,