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

Better hints for JSON serialization errors #99

Open
mike-north opened this issue Nov 30, 2016 · 0 comments
Open

Better hints for JSON serialization errors #99

mike-north opened this issue Nov 30, 2016 · 0 comments

Comments

@mike-north
Copy link

When using the shoebox, it would seem that the following would make sense

let response = await fetch(...);
let jsonData = await response.json();
shoeboxStore.currentUser = jsonData;
shoebox.put('user-data', myShoeboxStore);

In my case, I ended up getting a cryptic error message (in fastboot only)
screen shot 2016-11-30 at 1 11 49 am

Upon investigating this, it turns out that the jsonData I am given by way of fetch is likely modified at some point downstream (in my case a DS.Store#push), and it then becomes a circular JSON structure as relationships are wired up.

The end result is that, at the time I call shoebox.put, my object is serializable, but by the time the page is resolved (and the fastboot visit completes), it becomes partially resolved into a much more complex (and circular) structure.

Some ideas for improving this experience:

  • Better error messages around shoebox serialization
  • Add info to the readme about when the shoebox serialization takes place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants