Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Child queries for @deferred components are not properly reset when component is removed #1540

Closed
leonsenft opened this issue Aug 2, 2018 · 7 comments

Comments

@leonsenft
Copy link
Contributor

Consider the following example:

@Component(
  selector: 'example',
  template: '''
    <div *ngIf="show">
      <expensive @deferred></expensive>
    </div>
  ''',
  directives: [ExpensiveComponent, NgIf],
)
class ExampleComponent {
  @ViewChild(ExpensiveComponent)
  var deferredChild;

  bool get show => ...;
}

The deferredChild query is properly set with the deferred component when loaded; however, it's not reset to null when the enclosing structural directive removes the deferred component.

@matanlurey
Copy link
Contributor

@leonsenft I am assuming this could be a known issue and fixed in 5.1/5.0.1, right?

@matanlurey matanlurey added this to the =v5.1.0 milestone Aug 4, 2018
@matanlurey
Copy link
Contributor

@leonsenft My guess is this is the same issue as #1539?

@leonsenft
Copy link
Contributor Author

Possibly, but IIRC I think we just don't generate the code to invalidate queries in this case.

@leonsenft
Copy link
Contributor Author

Oh but this example uses the correct template, unlike the issue #1539.

@matanlurey
Copy link
Contributor

Ah OK, good point. I'll take a look after #1539 in any case.

leonsenft pushed a commit that referenced this issue Aug 9, 2018
Trying to get more context around the following bugs:
* #1539
* #1540

PiperOrigin-RevId: 208096491
leonsenft pushed a commit that referenced this issue Aug 9, 2018
Trying to get more context around the following bugs:
* #1539
* #1540

PiperOrigin-RevId: 208096491
leonsenft pushed a commit that referenced this issue Aug 9, 2018
Trying to get more context around the following bugs:
* #1539
* #1540

PiperOrigin-RevId: 208096491
leonsenft pushed a commit that referenced this issue Aug 10, 2018
Trying to get more context around the following bugs:
* #1539
* #1540

PiperOrigin-RevId: 208096491
@matanlurey
Copy link
Contributor

I'm hoping this is just #1539, but I'll validate after.

@matanlurey matanlurey self-assigned this Aug 10, 2018
matanlurey added a commit to matanlurey/angular that referenced this issue Aug 12, 2018
@matanlurey
Copy link
Contributor

This does work after #1539, and I'm adding a test in matanlurey@b328544.

matanlurey added a commit that referenced this issue Aug 13, 2018
Closes #1564

PiperOrigin-RevId: 208489962
matanlurey added a commit that referenced this issue Aug 13, 2018
Closes #1564

PiperOrigin-RevId: 208489962
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

2 participants