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

Returning an array as a value causes {"undefined":{"$type":"atom"}} in result #173

Open
mik01aj opened this issue Feb 12, 2016 · 0 comments

Comments

@mik01aj
Copy link

mik01aj commented Feb 12, 2016

Originally reported in Netflix/falcor#732.


Let say my route handler returns this:

{ path: ['things', thingId, 'linkedTopic'], value: ['topics', 123] }

Maybe you noticed - I forgot to wrap my value in Model.ref.

The returned result, when asking for ["things", 629026273, "linkedTopic", "headline"] is:

{"jsonGraph":{"things":{"629026273":{"linkedTopic":
    {"undefined":{"$type":"atom"}, "headline":{"$type":"atom"}}
}}}}

Definitely looks like a bug. 🪲

AFAIK returning arrays as results doesn't make any sense in Falcor (unless wrapped in ref or atom), so I guess you could just throw a meaningful error if there's an array returned as value.

The point is, returning array in place of a value doesn't make any sense (AFAIK), so Falcor should throw an Error instead of constructing weird objects with {"undefined":{"$type":"atom"}}. I never asked for key "undefined", so why do I get it in result? 🪲

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

1 participant