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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngx-formly fails at runtime with: ASSERTION ERROR: index #33924

Closed
juristr opened this issue Nov 19, 2019 · 3 comments

Comments

@juristr
Copy link
Contributor

@juristr juristr commented Nov 19, 2019

馃悶 bug report

Affected Package

The issue is caused by package @angular/core

Is this a regression?

Yes this worked seemlessly with ViewEngine under Angular 8.

Description

A clear and concise description of the problem...

When using ngx-formly with Ivy the app breaks. The compilation succeeds without issues but at runtime immediately when opening the app, I get the exception

ERROR Error: ASSERTION ERROR: index
    at throwError (core.js:1222)
    at assertLessThan (core.js:1196)
    at ViewContainerRef_._adjustIndex (core.js:17181)
    at ViewContainerRef_.insert (core.js:17104)
    at ViewContainerRef_.move (core.js:17131)
    at ViewContainerRef_.insert (core.js:17108)
    at FormlyField.renderField (ngx-formly-core.js:1165)
    at ngx-formly-core.js:1155
    at FormlyWrapperFormField.set [as fieldComponent] (ngx-formly-core.js:261)
    at FieldWrapper_Query (ngx-formly-core.js:1794)

which starts here in the Formly library.

馃敩 Minimal Reproduction

Pointing to a GitHub repo as it strangely "works" (?) on Stackblitz.

  1. git clone git@github.com:juristr/superforms-talk.git
  2. git checkout upgrade-ng9
  3. yarn install (or npm install)
  4. Go to http://localhost:4200/formly-basics/person-simple

The example is broken as the Material components don't animate properly and the devtools console gives the ASSERTION ERROR: index as mentioned above

馃敟 Exception or Error




ERROR Error: ASSERTION ERROR: index
    at throwError (core.js:1222)
    at assertLessThan (core.js:1196)
    at ViewContainerRef_._adjustIndex (core.js:17181)
    at ViewContainerRef_.insert (core.js:17104)
    at ViewContainerRef_.move (core.js:17131)
    at ViewContainerRef_.insert (core.js:17108)
    at FormlyField.renderField (ngx-formly-core.js:1165)
    at ngx-formly-core.js:1155
    at FormlyWrapperFormField.set [as fieldComponent] (ngx-formly-core.js:261)
    at FieldWrapper_Query (ngx-formly-core.js:1794)

馃實 Your Environment

Angular Version:




Angular CLI: 9.0.0-rc.2
Node: 11.6.0
OS: darwin x64
Angular: 9.0.0-rc.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.2
@angular-devkit/build-angular     0.900.0-rc.2
@angular-devkit/build-optimizer   0.900.0-rc.2
@angular-devkit/build-webpack     0.900.0-rc.2
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@ngtools/webpack                  9.0.0-rc.2
@schematics/angular               0.6.8
@schematics/update                0.900.0-rc.2
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.2

Anything else relevant?

Reporting it here, but could also be related to some ngx-formly implementation issue

@ngbot ngbot bot modified the milestone: needsTriage Nov 19, 2019
@IgorMinar IgorMinar modified the milestones: needsTriage, v9-blockers Nov 20, 2019
@IgorMinar IgorMinar changed the title ASSERTION ERROR: index ngx-formly fails at runtime with: ASSERTION ERROR: index Nov 20, 2019
@gnomeontherun

This comment has been minimized.

Copy link
Contributor

@gnomeontherun gnomeontherun commented Nov 22, 2019

I've also run into this in Clarity in our tabs component.

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Nov 26, 2019
When inserting a `viewRef` it is possible to not provide
an `index`, which is regarded as appending to the end of
the container.

If the `viewRef` already exists in the container, then
this results in a move. But there was a fault in the logic
that computed where to insert the `viewRef` that did not
account for the fact that the `viewRef` was already in
the container, so the insertion `index` was outside the
bounds of the array.

Fixes angular#33924
@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Nov 26, 2019

This should fix the problem : #34052

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Nov 26, 2019
When inserting a `viewRef` it is possible to not provide
an `index`, which is regarded as appending to the end of
the container.

If the `viewRef` already exists in the container, then
this results in a move. But there was a fault in the logic
that computed where to insert the `viewRef` that did not
account for the fact that the `viewRef` was already in
the container, so the insertion `index` was outside the
bounds of the array.

Fixes angular#33924
@juristr

This comment has been minimized.

Copy link
Contributor Author

@juristr juristr commented Nov 26, 2019

@petebacondarwin Awesome 馃憦. Once the next RC is out I'll give it another try. Thanks a lot

@matsko matsko closed this in f0f426b Nov 26, 2019
matsko added a commit that referenced this issue Nov 26, 2019
When inserting a `viewRef` it is possible to not provide
an `index`, which is regarded as appending to the end of
the container.

If the `viewRef` already exists in the container, then
this results in a move. But there was a fault in the logic
that computed where to insert the `viewRef` that did not
account for the fact that the `viewRef` was already in
the container, so the insertion `index` was outside the
bounds of the array.

Fixes #33924

PR Close #34052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can鈥檛 perform that action at this time.