Skip to content

Error trying to diff ‘[object Object]' needs to pass the error message #15402

Closed

Description

@b264

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Error trying to diff ‘[object Object]' Does not say what the actual error is. Once you get this, the path forward relies on diving into the angular source code since the error message was erased.

Expected behavior
Error trying to diff ‘[object Object]': ReferenceError: Invalid left-hand side in assignment Does not drop the actual reason there was an exception raised.

Minimal reproduction of the problem with instructions
Unknown how to minimally reproduce, specifically because the error message is dropped. This is in fact, the exact problem.

What is the motivation / use case for changing the behavior?
Dedicate time to fixing the problem instead of everyone needing to go into the angular source code when the bug is probably (but don't know) in their own project.

Please tell us about your environment:
Ubuntu 16.04LTE, geany 1.27, ionic2

  • Angular version: 2.2.1

  • Browser: all

  • Language: TypeScript 2.0.10

  • Node (for AoT issues): node --version = 6.9.2

Activity

  1. DzmitryShylovich commented on Mar 22, 2017

    @DzmitryShylovich
    Contributor

    Please provide reproduction in plunkr

  2. b264 commented on Mar 22, 2017

    @b264
    Author

    I cannot provide a minimum reproduction because it's private source code and I don't know which part triggers it, because the error is being hidden. I think the error comes from this line

    throw new Error(`Error trying to diff '${collection}'`);

  3. DzmitryShylovich commented on Mar 22, 2017

    @DzmitryShylovich
    Contributor

    I don't know which part triggers it

    debugger? probably ngClass/ngStyle/ngForTrackBy.
    we can't fix what we can't reproduce

  4. added a commit that references this issue on Mar 28, 2017
    b7fa5de
  5. b264 commented on Mar 28, 2017

    @b264
    Author
  6. b264 commented on Mar 28, 2017

    @b264
    Author

    I did figure out that changing this.data += results; to

    let i_offset: number = this.data.length;
    for(let index: number = 0; index < results.length; index++){
      this.data[index + i_offset] = results[index];
    }
    

    did fix the problem. Why -- I don't know. Which is troubling. this.data was being diff'd.

  7. added a commit that references this issue on Mar 29, 2017
    d74e4d0
  8. added a commit that references this issue on Aug 11, 2017
    fc30fa9
  9. added a commit that references this issue on Aug 28, 2017
    2c69443
  10. Daan298261 commented on Dec 13, 2017

    @Daan298261

    I have this curious problem as well. However the error says "DeckEditComponent.html:61 ERROR Error: Error trying to diff '4'. Only arrays and iterables are allowed".

    The "4" in question is the value passed in [ngValue]="user.id". When i change the ngValue to "user", the error changes to "trying to diff '[Object object]'". I have not a clue about why the code is trying to diff the ngValue...

  11. b264 commented on Dec 13, 2017

    @b264
    Author

    The [ ] is why it's trying to diff. Look at my fix above. I basically rebuilt the += operator from scratch and it worked. Why? Who knows

    It doesn't look like the error is coming from that line though. Is there an ngFor around that, like for user in users or something. If so, look at users

  12. angular-automatic-lock-bot commented on Sep 13, 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.

  13. locked and limited conversation to collaborators on Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions