ember-fastboot / ember-fastboot/fastboot

Better hints for JSON serialization errors

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
155
Forks
67
PR merge metrics
No merged PRs in 30d

Description

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

```js
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.