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

Error when using the same entity as reference twice #1207

Open
Wtower opened this issue Sep 21, 2016 · 2 comments
Open

Error when using the same entity as reference twice #1207

Wtower opened this issue Sep 21, 2016 · 2 comments
Labels

Comments

@Wtower
Copy link

Wtower commented Sep 21, 2016

Scope

An Angular error occurs when attempting to use the same entity as reference to two different fields in a creationView.

Prerequisites

Description

In the following configuration:

    productFamily.creationView().fields([
      nga.field('name'),
      nga.field('parent', 'reference')
        .targetEntity(productFamily)
        .targetField(nga.field('name'))
        .label('Parent family'),
      nga.field('parent2', 'reference_many')
        .targetEntity(productFamily)
        .targetField(nga.field('name'))
        .label('Parent family 2'),

Although the above is just an example, I have a different actual use case that I need to assign a reference to 2 different fields, one of which is multiple select. This use case involves the assignment of specification entities to a field named product_specs and to a field named product_sku_specs (multiple).

Of course I may be doing something wrong altogether, since I am still trying to find my way out. Btw, congrats for the project.

The error is:

Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: $item in $select.selected, Duplicate key: object:171, Duplicate value: {"value":"57dab634c7bfa33b623ee865","label":"Test"}
http://errors.angularjs.org/1.4.10/ngRepeat/dupes?p0=%24item%20in%20%24sele…%22value%22%3A%2257dab634c7bfa33b623ee865%22%2C%22label%22%3A%22Test%22%7D
    at angular.js:68
    at angular.js:28030
    at r (angular.js:16068)
    at h.$digest (angular.js:16203)
    at h.$apply (angular.js:16467)
    at HTMLDivElement.<anonymous> (angular.js:24076)
    at Ke (angular.js:3374)
    at HTMLDivElement.n (angular.js:3362)

Also, although the specific API call should return only 1 record ("Test"), and possibly be called only once, there are 2 API calls to the same URL, and in the second field 2 records are displayed (Test, Test). This does not happen if I remove the any of the fields.

Expected behavior: No error, a single record for the reference_many

Actual behavior: The above error, 2 records for the reference_many field.

@shifatul-i
Copy link

This is a BUG, I got the same error too, probably they will fix it soon.

@fzaninotto fzaninotto added the bug label Nov 18, 2016
@emathias
Copy link

emathias commented Feb 2, 2017

Is there any update on this issue ? I'm having the same problem and could not find a way to solve it.

Thanks!

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

No branches or pull requests

4 participants