Skip to content

Regression: detectChangesOnRender behavior changes in v13 #346

Closed
@dzonatan

Description

@dzonatan

I'm trying out the new v13 version and noticed that detectChangesOnRender (previously detectChanges) property started to behave differently.
It seems that it no longer can be used to postpone the rendering, even with a false value the component tries to resolve the entire template with all its interpolations, bindings, children components, etc.

test('regression test', async () => {
  @Component({
    selector: 'my-fancy-comp',
    template: `{{ myObj.myProp }}`,
  })
  class MyComponent {
    myObj: any = null;
  }

  // <= v12 works ok
  // v13 fails with `TypeError: Cannot read properties of null (reading 'myProp')`
  await render(MyComponent,{
    detectChangesOnRender: false
  });
});

I've also noticed a new autoDetectChanges property which by setting false seems to do the job. But as I understood - it completely turns off the automatic change detection, which is very inconvenient if you only need to postpone the first cycle (just to setup things).
Release notes do not say much about these behaviour changes and especially autoDetectChanges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions