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

(1.6.0) Array methods return undefined #195

Closed
cwayfinder opened this issue Sep 17, 2018 · 7 comments
Closed

(1.6.0) Array methods return undefined #195

cwayfinder opened this issue Sep 17, 2018 · 7 comments

Comments

@cwayfinder
Copy link

cwayfinder commented Sep 17, 2018

  • Version: 1.6.0
  • SIMPLE Reproduction:
draft.items.find(({ id }) => id === extraId);
  • Expected behavior: return the item of the array if it exists
  • Actual behavior: return undefined
@mweststrate
Copy link
Collaborator

Given that the above doesn't give any insight in what extraId is, or doesn't exclude that the bug is somewhere else (typo, etc etc), please create a small, runnable, reproduction in codesandbox or as PR with unit test on this repo. (Tip: use gitpod).

@lotz
Copy link

lotz commented Sep 18, 2018

I just ran into an issue with Arrays had to downgrade to 1.5.0 to get around it. Not sure if it's quite the same as this, but using a forEach with draft state (a proxy) in an NGXS app would cause a stack overflow error. Attempting to access a single element of the draft state array by index would result in an undefined, so something is up with Arrays in 1.6.0.

I can hopefully put together a simple repro case this week.

(I just tried reproducing this in StackBlitz, but the state objects do not appear to be proxies when using the produce method, so I don't see the issue: https://stackblitz.com/edit/angular-esfjza)

mweststrate added a commit that referenced this issue Sep 18, 2018
@mweststrate
Copy link
Collaborator

@cwayfinder As shown in above commit, the find method works as expected. So please provide a reproduction or close this issue.

@lotz
Copy link

lotz commented Sep 18, 2018

I should have mentioned in my comment, and it may be related to the original comment in this issue, but this only came up when building my entire app for production (ng build --prod). It did not happen in Dev mode.

@mweststrate
Copy link
Collaborator

@lotz that sounds like a different issue. If the problem persists please create a new issue including reproducible reproduction.

@lotz
Copy link

lotz commented Sep 19, 2018

Thanks @mweststrate. Just opened #198 with repro steps and example code.

@mweststrate
Copy link
Collaborator

Closing for a lack of reproduction. #198 has been solved in the mean time, so upgrading to 1.7.2 might fix the issue, if the cause is related

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

No branches or pull requests

3 participants