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

JSON conversion error with store.findAll #1

Open
nickschot opened this issue Oct 26, 2017 · 2 comments
Open

JSON conversion error with store.findAll #1

nickschot opened this issue Oct 26, 2017 · 2 comments

Comments

@nickschot
Copy link

nickschot commented Oct 26, 2017

A model hook as follows:

@shoeboxModel
model(){
    return this.store.findAll('post');
}

results in a JSON parsing error. I get this when using ember-data + fastboot + ember-ajax. This is likely because the ember model instance has a circular reference of some kind.

Might be related to: ember-fastboot/fastboot#99

Stacktrace:

TypeError: Converting circular structure to JSON
  at JSON.stringify (<anonymous>)
  at createShoebox (/ember-fastboot-test/node_modules/fastboot/src/ember-app.js:456:26)
  at visitRoute.then (/ember-fastboot-test/node_modules/fastboot/src/ember-app.js:325:11)
  at tryCatch (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/rsvp.js:411:1)
  at invokeCallback (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/rsvp.js:424:1)
  at publish (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/rsvp.js:394:1)
  at /ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/ember-testing/ext/rsvp.js:14:1
  at invokeWithOnError (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/backburner.js:283:1)
  at Queue.flush (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/backburner.js:153:1)
  at DeferredActionQueues.flush (/ember-fastboot-test/tmp/broccoli_merge_trees-output_path-Zr7UN3Cf.tmp/assets/backburner.js:345:1)
@topaxi
Copy link
Owner

topaxi commented Oct 26, 2017

Yeah this is not going to work with Ember Data, I should probably mention this in the README.md.

Ember Data would need more logic like pushing the original response into the store.

@nickschot
Copy link
Author

That'll work for me! A note in the README would be good indeed.

Workaround which currently works for ember-data: https://github.com/Appchance/ember-cached-shoe

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

2 participants