mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Prevent components from being defined multiple times (#1627)
This commit is contained in:
@@ -40,7 +40,6 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
|||||||
abstract serverInfo: sqlops.ServerInfo;
|
abstract serverInfo: sqlops.ServerInfo;
|
||||||
private _onEventEmitter = new Emitter<any>();
|
private _onEventEmitter = new Emitter<any>();
|
||||||
|
|
||||||
|
|
||||||
initializeModel(rootComponent: IComponentShape, validationCallback: (componentId: string) => Thenable<boolean>): void {
|
initializeModel(rootComponent: IComponentShape, validationCallback: (componentId: string) => Thenable<boolean>): void {
|
||||||
let descriptor = this.defineComponent(rootComponent);
|
let descriptor = this.defineComponent(rootComponent);
|
||||||
this.rootDescriptor = descriptor;
|
this.rootDescriptor = descriptor;
|
||||||
@@ -50,6 +49,10 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private defineComponent(component: IComponentShape): IComponentDescriptor {
|
private defineComponent(component: IComponentShape): IComponentDescriptor {
|
||||||
|
let existingDescriptor = this.modelStore.getComponentDescriptor(component.id);
|
||||||
|
if (existingDescriptor) {
|
||||||
|
return existingDescriptor;
|
||||||
|
}
|
||||||
let typeId = componentRegistry.getIdForTypeMapping(component.type);
|
let typeId = componentRegistry.getIdForTypeMapping(component.type);
|
||||||
if (!typeId) {
|
if (!typeId) {
|
||||||
// failure case
|
// failure case
|
||||||
|
|||||||
Reference in New Issue
Block a user