Skip to content

[ivy]: experimentalIvy flag generates an app with no change detection #13024

Closed

Description

@cexbrayat

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 7.1.0-rc.0
Node: 8.11.3
OS: darwin x64
Angular: 7.1.0-rc.0

Repro steps

Generate a new app with experimentalIvy

ng new ivy-cd --experimental-ivy --defaults
cd ivy-cd
$(npm bin)/ivy-ngcc
ng serve --aot

add a simple setTimeout in app.component.ts like:

constructor() {
  setTimeout(() => {
    console.log('set timeout');
    this.title = 'hello';
  }, 2000);
}

will result in a trace in the browser console, but no update in the DOM. It looks like change detection is not run. After discussing with @jasonaden on Slack, he confirms that if the app is bootstrapped using renderComponent (as it is currently when using the experimentalIvy flag) then CD is not running. But he pointed out that using platformBrowser fixes it, and indeed it does.

Desired functionality

The experimentalIvy flag could be simplified to probably just add the Angular compiler option in tsconfig.app.json but the rest could be removed and use the default bootstrap mechanism.

Mention any other details that might be useful

I can submit a PR if the CLI team agrees.

@jasonaden asked me to also cc @alxhub for his input.

Activity

  1. added this to the needsTriage milestone on Nov 21, 2018
  2. klimentru1986 commented on Dec 17, 2018

    @klimentru1986

    @cexbrayat try to use markDirty function. Example here.

    Or you can do it in bowser console

    // Get component
    let comp = ng.getComponent(document.querySelector('app-root'));
    // MarkDirty
    ng.markDirty(comp);
    
  3. cexbrayat commented on Dec 17, 2018

    @cexbrayat
    MemberAuthor

    @klimentru1986 Yes this is possible, but the point of this issue is to revert the change to the bootstrap setup that the experimentalIvy flag adds. It is now not necessary to use markDirty if you bootstrap the app using platformBrowser instead of renderComponent.

  4. IgorMinar commented on Dec 20, 2018

    @IgorMinar
    Contributor

    Given that we want to roll out ivy as backwards compatible solution, I think this proposal makes sense.

    So the way this would work is that you ng new a new app in a normal way. Turn on enableIvy in tsconfig, run ngcc, and then the toolchain uses ngtsc to build the app with ivy.

    eventually we need to figure out how to integrate ngcc into this workflow more tightly so that it's not a step developer needs to do explicitly, but that will be a bigger change and should be handled separately.

  5. self-assigned this
    on Dec 21, 2018
  6. added a commit that references this issue on Jan 11, 2019
    f94576b
  7. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 9, 2019
  9. added a commit that references this issue on May 29, 2026
    6cd8660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions