Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.
This repository was archived by the owner on May 25, 2021. It is now read-only.

Augury does not show the state of components when inheriting #1254

@splincode

Description

@splincode
  1. If we explicitly indicate a dependency, then we can completely debug the state of the component
  • ServiceA:
@Injectable()
export class ServiceA {
	state1 = {
		etc: {}
	}
}
  • AppComponent:
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';

  constructor(a: ServiceA) {
  	console.log(a); // ServiceA {state1: {…}}
  }

}

image

  1. With the usual inheritance, everything is fine
  • All services:
@Injectable()
export class ServiceA {
	state1 = {
		etc: {}
	}
}

@Injectable()
export class ServiceB {
	state2 = {
		etc: {}
	}
}


@Injectable()
export class ServiceC {
	state3 = {
		etc: {}
	}
}


@Injectable()
export class ServiceD {
	state4 = {
		etc: {}
	}
}


@Injectable()
export class ServiceE {
	state5 = {
		etc: {}
	}
}


@Injectable()
export class ServiceF {
	state6 = {
		etc: {}
	}
}
  • AppComponent
export class SmartComponent {

	protected titleSmart = 'app-smart';
	protected a: ServiceA;
	protected b: ServiceB;
	protected c: ServiceC;
	protected d: ServiceD;
	protected e: ServiceE;
	protected f: ServiceF;

	constructor(context: Injector) {
		this.a = context.get(ServiceA);
		this.b = context.get(ServiceB);
		this.c = context.get(ServiceC);
		this.d = context.get(ServiceD);
		this.e = context.get(ServiceE);
		this.f = context.get(ServiceF);
	}


}


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent extends SmartComponent {

  constructor(context: Injector) {
  	super(context);
  	console.log(this.a); // ServiceA {state1: {…}}
  }

}

image

  1. But we do not see the states assigned to the multi parent component
export abstract class CoreInjector {

	protected titleSmart = 'app-smart';
	protected a: ServiceA;
	protected b: ServiceB;
	protected c: ServiceC;
	protected d: ServiceD;
	protected e: ServiceE;
	protected f: ServiceF;

	constructor(context: Injector) {
		this.a = context.get(ServiceA);
		this.b = context.get(ServiceB);
		this.c = context.get(ServiceC);
		this.d = context.get(ServiceD);
		this.e = context.get(ServiceE);
		this.f = context.get(ServiceF);
	}


}

export abstract class SmartComponent extends CoreInjector {
	constructor(context: Injector) {
		super(context);
	}
}


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent extends SmartComponent {

  constructor(context: Injector) {
  	super(context);
  	console.log(this.a)
  }

}

image

Augury version (required): 1.14.0
Angular version: 4+
OS: Windows 7

Analog: #903

Additional details:
We do not see the dependencies assigned to the parent component

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions