Skip to content

Better hints for JSON serialization errors #99

Open
@mike-north

Description

@mike-north

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions