-
Notifications
You must be signed in to change notification settings - Fork 439
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
Got "RangeError: Maximum call stack size exceeded" for many to many relation #2116
Comments
@samselikoff may I attract your attention? It sits here for a while already... |
@samselikoff as a matter of fact I have defined models (see https://github.com/stukalin/embermiragetestselfreferences/tree/master/app/models) and this setup works in normal (non-test) env. Or am I missing anything? |
Spent a few hours on this. Have tracked it down to this line https://github.com/miragejs/miragejs/blob/46fcd385ccc1495fb44b2aac92163a4eda2e0dab/lib/serializer.js#L403 At some point the included resources has no models, this causes the line a few down https://github.com/miragejs/miragejs/blob/46fcd385ccc1495fb44b2aac92163a4eda2e0dab/lib/serializer.js#L408 to create an empty array and that breaks it out of the loop. When you run tests, it always has a model. I have not yet found why the resource has no model (making it work). It seems to be it should always have a model and thus never work. Will spend more time when I can but there is clearly some magic code that breaks it out. Its not the didSerialize array, when it does work its checking against |
@cah-briangantzler @samselikoff When I use my fixtures I don't explicitly create circular references, i.e. I declare my entities like this
and ember (or is it still mirage?) is smart enough to realise that the space and the spaceview and the web are referring each other and they are reachable from each other. Now when I try to create the same setup in my test
the following happens: when I add an entity which has a reference in an already declared entity then this already declared entity receives the ID of the new entity, i.e. after adding e.g. a spaceview my space would implicitly receive A possible workaround to this is not to create models via
which is fine, but I'd prefer to use the |
Do you possibly have a repo with this data I could then step through and possibly see the problem. First guess this would be in mirageJS not ember-cli-mirage, so posting an issue there may also get you a response |
@cah-briangantzler yep, was in the original post: https://github.com/stukalin/embermiragetestselfreferences. Do you think I should duplicate the issue in the miragejs repo? I agree it really seems like to be more relevant there. |
I think you should, will be more likely to get Sams attention there |
The setup is the following: I have models called
web
,space
andspaceview
. Spaces and spaceviews are many-to-many and aweb
entity has lists of spaces and spaceviews. I use the REST serializer with theinclude
method so that I want to return my spaces and spaceviews whenever I fetch webs.I have a following acceptance test:
when I run it I've got my error
At the same time if I use a set of fixtures to load the same setup it works fine (in normal dev i mean).
It's possible that I setup my tests incorrectly, if that's the case any help would be appreciated. Otherwise it looks like a bug to me.
Sorry, saw the boilerplate link too late, I've created a small example app myself, here it is https://github.com/stukalin/embermiragetestselfreferences
Use the
http://localhost:4200/tests
to see the issue and thehttp://localhost:4200/web
to see the same setup in dev environment with fixtures.The text was updated successfully, but these errors were encountered: