question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComponentProperties no longer in ngOnChanges

See original GitHub issue

After updating to 10.4.0 we saw a bunch of tests that were suddenly failing. After a bit of digging I realized each component implemented OnChanges and in the ngOnChanges() function we were looking for an @Input property to be in the changes object. It seems with the latest changes any @Input property that is set in componentProperties is never in the changes object in ngOnChanges.

Quick example:

@Component
class Component implements OnChanges {
  @Input() someProperty: string

  ngOnChanges(changes: SimpleChanges) {
    if(changes.someProperty) {
      // Do something if @Input property changed
    }
  }
}
render(Component, {
  componentProperties: {someProperty: 'value'}
})

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
swhammackcommented, Mar 18, 2021

@timdeschryver thanks for the quick fix!

1reaction
swhammackcommented, Mar 18, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

ngOnChanges not firing for nested object - Stack Overflow
The problem is that ngOnChanges does not fire when rawLapsData changes in the parent. What can I do? import {Component, Input, OnInit, OnChanges,...
Read more >
Component initialization without ngOnInit with async pipes for ...
The special case occurs when the component has no inputs at all — in this situation, there is no point for ngOnChanges and...
Read more >
Passing route params into angular component's Input ...
ngOnChanges hook is not being triggered when routing params change; the params passed into the component even there is no Input decorator ...
Read more >
Change Detection in Angular: Everything You Need to Know
The DOM is updated when the input property changes, even though the change detector reference remains detached. checkNoChanges. This last method ...
Read more >
GoJS and Angular -- Northwoods Software
Without this, your styling will not effect the component divs. Read more about Angular view encapsulation here. Your @Component decorator for the component ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found