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

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

Closed
splincode opened this issue Dec 5, 2017 · 3 comments
Closed

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

splincode opened this issue Dec 5, 2017 · 3 comments

Comments

@splincode
Copy link

  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

@e-schultz
Copy link

related: #1114

@santiago-elustondo
Copy link
Contributor

Can you try the latest Canary Build, and tell me if the issue persists there?

@santiago-elustondo
Copy link
Contributor

santiago-elustondo commented May 16, 2018

Version 1.16.2 released just now, which brings the official Chrome and FireFox versions up-to-date with the Canary Build. Please reopen if the issue persists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants