Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: detectChangesOnRender behavior changes in v13 #346

Closed
dzonatan opened this issue Dec 15, 2022 · 1 comment · Fixed by #347
Closed

Regression: detectChangesOnRender behavior changes in v13 #346

dzonatan opened this issue Dec 15, 2022 · 1 comment · Fixed by #347

Comments

@dzonatan
Copy link
Contributor

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.

@timdeschryver
Copy link
Member

Thanks @dzonatan !

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

Successfully merging a pull request may close this issue.

2 participants