Skip to content

ComponentProperties no longer in ngOnChanges #188

Closed
@swhammack

Description

@swhammack

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'}
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions